Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
queryYesWhat to search for in memory
session_idYesReasoning session identifier

Implementation Reference

  • 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 }; } }
  • 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 ], }));

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/angrysky56/advanced-reasoning-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server