收窄返回过多结果的搜索
提高 limit 之前先添加 scope 和 path filter;对未指定 scope 的 query 只扩大 limit 会带来更多 noise,而不是更多 signal。
search_memory({
query: "token identity fallback",
limit: 5
})公开 MCP 工具
search_memory
用途
以严格的 targeted-match 语义搜索已授权的 XMemo memory,避免将弱匹配静默地当作答案。
适用场景
- 调用者知道相关的 project、team、path 或 memory type,需要 targeted lookup。
- 将弱 semantic match 作为结果呈现会产生误导或不安全。
- 需要明确的 scope/team filter、retrieval 说明或更大的受控结果集。
不适用场景
- 不要用于快速、未指定 scope 且宽容的 lookup;请使用 recall。
- 不要用它构建 multi-memory prompt context pack;请使用 recall_context。
- 不要用它修改或删除 memory。
- REST API 接受的 field set 比 public MCP tool 更宽;scope、bucket、team 和 provenance filter 见 /docs/api/memory。
所需权限范围
- 需要 memory:read;scope 和 team_id filter 不能扩大调用者的 authorization boundary。
参数列表
| 参数名 | 类型 | 描述 |
|---|---|---|
query | string · 必填 | 要匹配的准确 topic 或 wording。 |
limit | integer · 默认值: 5 | 结果数量。 |
path_filter | string · 默认值: % | 仅适用于 Claude plugin profile:logical-path ILIKE filter。Generic public profile 不接受此参数。 |
memory_type | string · 默认值: % | 仅适用于 Claude plugin profile:memory type filter。Generic public profile 不接受此参数。 |
prefer_working | boolean · 默认值: false | 仅适用于 Claude plugin profile:将 active working state 排在 vector results 之前。 |
返回模式
返回包含 opaque references、locations、content 以及可选 explanation/agent-boundary metadata 的排序文本响应。结果仍仅限于已授权的 memory。
使用示例
search_memory({
query: "token identity fallback",
limit: 5
})错误信息
- 401/403:请求没有 memory:read,或无法访问选择的 scope/team。
- Validation failure:query、limit、path pattern 或 memory type 无效。
- No-match response:没有强结果同时满足目标和已授权 filter;调用者不得静默改用 recall 语义。
关联工具
- recall — 当不需要严格匹配时使用宽容的 best-effort retrieval。
- recall_context — 使用有界的 multi-memory retrieval 生成 prompt context。
- forget — 先审查返回的 reference,再删除准确的 record。
来源: MCP 工具界面