query_reasoning_memory
Search the reasoning memory system to retrieve related insights, hypotheses, and evidence. Use this tool to find solved problems, understand idea connections, and build on prior reasoning sessions within a specific session ID.
Instructions
Query the integrated memory system to find related insights, hypotheses, and evidence.
Useful for:
Finding similar problems solved before
Retrieving relevant hypotheses and evidence
Understanding connections between ideas
Building on previous reasoning sessions
Parameters:
session_id: The reasoning session to query within (required)
query: What to search for in memory (required)
Returns related memories with confidence scores and connection information.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | What to search for in memory | |
| session_id | Yes | Reasoning session identifier |
Implementation Reference
- src/index.ts:877-910 (handler)Core handler implementation in AdvancedReasoningServer class that queries the memory graph for related nodes matching the input query within the specified session, returns formatted JSON with results and stats.public queryMemory(sessionId: string, query: string): { content: Array<{ type: string; text: string }>; isError?: boolean } { try { const relatedNodes = this.memory.queryRelated(query, 10); const session = this.memory.getSession(sessionId); return { content: [{ type: "text", text: JSON.stringify({ query, sessionContext: session, relatedMemories: relatedNodes.map(node => ({ content: node.content, type: node.type, confidence: node.confidence, connections: node.connections.length })), memoryStats: this.memory.getMemoryStats() }, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: JSON.stringify({ error: error instanceof Error ? error.message : String(error), status: 'failed' }, null, 2) }], isError: true }; } }
- src/index.ts:1119-1142 (schema)Defines the Tool object for query_reasoning_memory including name, description, and input schema validation.const QUERY_MEMORY_TOOL: Tool = { name: "query_reasoning_memory", description: `Query the integrated memory system to find related insights, hypotheses, and evidence. Useful for: - Finding similar problems solved before - Retrieving relevant hypotheses and evidence - Understanding connections between ideas - Building on previous reasoning sessions Parameters: - session_id: The reasoning session to query within (required) - query: What to search for in memory (required) Returns related memories with confidence scores and connection information.`, inputSchema: { type: "object", properties: { session_id: { type: "string", description: "Reasoning session identifier" }, query: { type: "string", description: "What to search for in memory" } }, required: ["session_id", "query"] } };
- src/index.ts:1324-1326 (registration)Registration/dispatch in the main CallToolRequestHandler switch statement that routes tool calls to the queryMemory method.case "query_reasoning_memory": const { session_id, query } = args as { session_id: string; query: string }; return reasoningServer.queryMemory(session_id, query);
- src/index.ts:1302-1315 (registration)Registration in ListToolsRequestHandler where QUERY_MEMORY_TOOL is included in the list of available tools returned to clients.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ ADVANCED_REASONING_TOOL, QUERY_MEMORY_TOOL, CREATE_LIBRARY_TOOL, LIST_LIBRARIES_TOOL, SWITCH_LIBRARY_TOOL, GET_LIBRARY_INFO_TOOL, CREATE_SYSTEM_JSON_TOOL, GET_SYSTEM_JSON_TOOL, SEARCH_SYSTEM_JSON_TOOL, LIST_SYSTEM_JSON_TOOL ], }));