{"record":{"id":"fff104eb67d7d28e","repo":"thedotmack/claude-mem","slug":"unknown-tool-name","errorCode":null,"errorMessage":"Unknown tool: ${name}","messagePattern":"Unknown tool: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/server/mcp/recall-mcp-server.ts","lineNumber":133,"sourceCode":"    const observations = await backend.context({\n      projectId: requireString(args, 'projectId'),\n      query: requireString(args, 'query'),\n      limit: clampLimit(args.limit, CONTEXT_LIMIT),\n    });\n    const context = observations\n      .map((o) => (o as { content?: unknown }).content)\n      .filter((t): t is string => typeof t === 'string' && t.length > 0)\n      .join('\\n\\n');\n    return jsonResult({ observations, context });\n  }\n  if (name === 'recent') {\n    const observations = await backend.recent({\n      projectId: requireString(args, 'projectId'),\n      limit: clampLimit(args.limit, RECENT_LIMIT),\n    });\n    return jsonResult({ observations });\n  }\n  throw new Error(`Unknown tool: ${name}`);\n}\n\n/**\n * 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 {","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/server/mcp/recall-mcp-server.ts#L115-L151","documentation":"dispatchToolCall() resolves the requested tool name to a handler; if the name does not match any registered tool, it throws `Unknown tool: <name>`. This signals the MCP server received a call for a tool it does not expose.","triggerScenarios":"Calling the MCP server with a tool name not in its registry — typos, renamed tools, or tools from a different MCP server.","commonSituations":"Client tool list cached from an older server version after a rename; hard-coded tool names in scripts; pointing a client at the wrong MCP server that lacks the tool; case-sensitivity mismatches.","solutions":["Check the server's tool list (tools/list) and use an exact registered tool name","Fix typos and case in the tool name on the client","Restart/refresh the client so it re-fetches the current tool registry","Verify the client is connected to the recall MCP server that actually exposes the tool"],"exampleFix":"// before\nawait client.callTool('recent_observations', args);\n// after (registered name is 'observations')\nawait client.callTool('observations', args);","handlingStrategy":"validation","validationCode":"const KNOWN_TOOLS = ['observations', 'recent'];\nif (!KNOWN_TOOLS.includes(toolName)) {\n  throw new Error(`Unknown tool: ${toolName}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const result = await dispatchToolCall(name, args);\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Unknown tool:')) {\n    // refresh tool registry and/or fall back to tools/list to find the right name\n  }\n  throw e;\n}","preventionTips":["Fetch tools/list after connecting instead of hard-coding tool names","Bump client tool registry whenever the MCP server version changes","Share a single constant/enum of tool names between server and client code"],"tags":["mcp","tool-routing","unknown-tool","dispatch"],"backgroundTag":"resource-not-found","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"}