Skip to content

feat(mcp): expose space param on memory_search#17

Merged
yhyyz merged 1 commit into
ourmem:mainfrom
doctatortot:upstream-clean/plugin-space-param
May 20, 2026
Merged

feat(mcp): expose space param on memory_search#17
yhyyz merged 1 commit into
ourmem:mainfrom
doctatortot:upstream-clean/plugin-space-param

Conversation

@doctatortot
Copy link
Copy Markdown
Contributor

Summary

The omem server's /v1/memories/search endpoint already accepts a space query param that filters which spaces to search across (comma-separated IDs, a single ID, or all). The MCP plugin's memory_search tool didn't expose it, so callers had no way to scope a query to specific spaces from a tool call.

This adds space?: string to:

  • the memory_search tool's input schema
  • searchMemories() in client.ts (passes through to URL params)

Why this matters

The natural use case is per-session scoping (e.g. "this Claude instance defaults to my homelab space") combined with per-query overrides ("for this specific question, also look in the synchresis space because the answer's there"). Both work through the same parameter — set as a session default by the caller, or pass per-call.

Without it, an agent can't take a hint like "the ELINA notes are in the synchresis space" and run a targeted cross-space query — it'd have to fall back to the default (which may or may not include that space, depending on the user's role and membership).

The server side is already wired (api/handlers/memory.rs:332 does the comma-split + 'all' handling). This is just plumbing the client surface to match.

Compat

  • Optional param. Omitting it preserves the existing "search all accessible spaces" behavior.
  • No server change required.
  • No version bump implied.

Context

Part of evaluating omem for a team rollout at Synchresis (the MSP I work at). The spaces feature is the foundation we'd use to separate canonical org content from personal scratch content; per-query space scoping is what makes the conversational UX work ("this question is about $TOPIC which lives in $SPACE") rather than forcing users to bounce between sessions or maintain mental scope.

🤖 Generated with Claude Code

The omem server's `/v1/memories/search` endpoint already accepts a
`space` query param that filters which spaces to search across
(comma-separated IDs, a single ID, or `all`). The MCP plugin's
`memory_search` tool didn't expose it, so callers had no way to scope
a query to specific spaces from a tool call.

This adds `space?: string` to:
- the `memory_search` tool's input schema
- `searchMemories()` in client.ts (passes through to URL params)

Why this matters: the natural use case is per-session scoping (e.g.
"this Claude instance defaults to my homelab space") plus per-query
overrides ("for this specific question, also look in the synchresis
space because the answer's there"). Both work through the same
parameter — set as a session default by the caller, or pass per-call.

No breaking change — the param is optional and omitting it preserves
the existing "search all accessible spaces" behavior.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@yhyyz yhyyz merged commit 574107f into ourmem:main May 20, 2026
1 check failed
@yhyyz
Copy link
Copy Markdown
Contributor

yhyyz commented May 20, 2026

Merged — thanks! Clean addition, makes per-query space scoping actually usable from MCP clients. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants