read_memory
Retrieve stored data from persistent memory using exact keys to access agent-specific information. This tool enables reading previously saved content for continuity in AI agent operations.
Instructions
Read a persistent memory by exact key. Cost: $0.001 USDC. Service: memex.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent_id | Yes | ||
| key | Yes |
Implementation Reference
- src/index.ts:166-223 (handler)The codebase implements a dynamic MCP server that fetches available tools (including potentially 'read_memory') from a remote registry at runtime. The execution logic for any tool is handled by this generic CallToolRequestSchema handler, which identifies the tool by name and invokes it via the `callTool` helper.
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), }), }, ], }; } });