{"record":{"id":"f9a6122209acca8f","repo":"thedotmack/claude-mem","slug":"recall-mcp-tool-call-failed","errorCode":null,"errorMessage":"recall MCP tool call failed","messagePattern":"recall MCP tool call failed","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/server/mcp/recall-mcp-server.ts","lineNumber":155,"sourceCode":" * Build a read-only recall MCP server bound to `backend`. The caller owns the\n * transport (stdio in the CLI, streamable-HTTP in Server Beta).\n */\nexport function createRecallMcpServer(backend: RecallBackend, version: string): Server {\n  const server = new Server(\n    { name: 'claude-mem', version },\n    { capabilities: { tools: {} } },\n  );\n\n  server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));\n\n  server.setRequestHandler(CallToolRequestSchema, async (request): Promise<CallToolResult> => {\n    const name = request.params.name;\n    const args = (request.params.arguments ?? {}) as Record<string, unknown>;\n    try {\n      return await dispatchToolCall(backend, name, args);\n    } catch (error) {\n      const err = error instanceof Error ? error : new Error(String(error));\n      logger.warn('SYSTEM', 'recall MCP tool call failed', { tool: name }, err);\n      return { isError: true, content: [{ type: 'text', text: err.message }] };\n    }\n  });\n\n  return server;\n}\n\nexport const RECALL_MCP_TOOLS = TOOLS;\n","sourceCodeStart":137,"sourceCodeEnd":164,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/server/mcp/recall-mcp-server.ts#L137-L164","documentation":"The recall MCP server wraps every tool dispatch in a try/catch; when dispatchToolCall throws for any tool invocation, it logs this warning and returns an isError result containing the underlying error message instead of crashing the MCP server.","triggerScenarios":"Any MCP client calls a recall tool (by name from request.params.name) with bad arguments, an unknown tool name, or when the backend throws while processing the query.","commonSituations":"MCP client sends malformed arguments (missing/incorrectly typed params); backend database unavailable; unknown tool name from a stale client config.","solutions":["Check the logged err (via logger.warn output) for the root cause","Verify the tool name and arguments against the server's declared tool schema","Ensure the backend (database/index) is running and reachable","Update the MCP client configuration if the tool name changed between versions"],"exampleFix":"// before\nawait mcp.callTool('recall_search', { q: 'text' }); // wrong arg name\n// after\nawait mcp.callTool('recall_search', { query: 'text' }); // match server schema","handlingStrategy":"try-catch","validationCode":"const tools = await client.listTools();\nif (!tools.some(t => t.name === 'recall_search')) throw new Error('recall_search not offered by server');","typeGuard":"function isValidToolArgs(args: unknown): args is Record<string, unknown> {\n  return typeof args === 'object' && args !== null;\n}","tryCatchPattern":"try {\n  const res = await client.callTool({ name, arguments });\n  if (res.isError) console.warn('tool error:', res.content[0].text);\n} catch (e) {\n  console.error('MCP call failed', e);\n}","preventionTips":["Validate tool arguments against the server schema before calling","Keep MCP client configs in sync with server tool names","Monitor the server logs (logger.warn) for root causes"],"tags":["mcp","tool-dispatch","rpc"],"backgroundTag":"api-request-failed","analyzedSha":"d8bc9755e74915e5c3b999181e10a67c889bce2a","analyzedAt":"2026-09-17T16:40:26.182Z","contentChangedAt":"2026-09-17T16:40:26.182Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}