search_memory
Search agent memories semantically to find relevant information using natural language queries. Returns top matches based on relevance.
Instructions
Semantic search across all agent memories. Returns most relevant matches. Cost: $0.005 USDC. Service: memex.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent_id | Yes | ||
| query | Yes | ||
| top_k | No |
Implementation Reference
- src/index.ts:166-223 (handler)The "search_memory" tool (along with all other tools) is dynamically handled by this CallToolRequestSchema handler. It fetches tools from a remote registry and executes them via callTool.
server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; let registry: Registry; try { registry = await fetchRegistry(); } catch (error) { return { content: [ { type: "text", text: JSON.stringify({ error: "Failed to fetch tool registry", detail: String(error) }), }, ], }; } const tool = registry.tools.find((t) => t.name === name); if (!tool) { return { content: [ { type: "text", text: JSON.stringify({ error: `Tool '${name}' not found`, available_tools: registry.tools.map((t) => t.name), }), }, ], }; } try { const result = await callTool(tool, args as Record<string, unknown>); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: JSON.stringify({ error: "Tool call failed", tool: name, service: tool.service, detail: String(error), }), }, ], }; } });