区分空结果与失败
空结果是有效的 no-match 答案。凭据缺失或权限不足时,则会返回 401 或 403。
recall({ query: "a topic that was never saved", limit: 3 })
// -> empty result set, HTTP 200公开 MCP 工具
recall
用途
执行轻量、宽容的 best-effort lookup,在回答前返回少量最相关的已保存 memory。
适用场景
- 需要快速、未指定 scope 的答案,并且可以接受弱但有用的相关性。
- 调用者希望得到少量排序后的 memory,而不是适合 prompt 大小的 context pack。
- task 开始检查需要近期 working context,但不需要严格的 project/team filter。
不适用场景
- 当弱匹配不能被当作答案呈现时不要使用;严格匹配请使用 search_memory。
- 不要用它组装多个有界 memory 进行 prompt injection;请使用 recall_context。
- 不要用它写入、更新或删除 memory。
- REST API 接受的 field set 比 public MCP tool 更宽;scope、bucket、team 和 provenance filter 见 /docs/api/memory。
所需权限范围
- 需要 memory:read;返回的 memory 仍受经过认证的 owner/team scope 限制。
参数列表
| 参数名 | 类型 | 描述 |
|---|---|---|
query | string · 必填 | 要 recall 的自然语言问题或主题。 |
limit | integer · 默认值: 5 | 保持有界、用于快速 lookup 的少量结果数。 |
返回模式
包含每条 memory 的 reference、location、content 和可用 attribution boundary 的排序文本响应。空结果是有效的 no-match 响应,不是 authorization signal。
使用示例
recall({
query: "current MCP authentication decision",
limit: 3
})错误信息
- 401/403:请求没有有效 bearer token 或缺少 memory:read。
- Validation failure:query、limit 或 filter syntax 无效。
- Scope or team mismatch:请求的 boundary 对经过认证的 owner 不可见。
关联工具
- search_memory — 使用 project/team filter 执行严格的 targeted matching。
- recall_context — 使用有界的 multi-memory context pack。
- remember — 保存明确需要持久化的 fact 或 decision。
来源: MCP 工具界面