{"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/d768ba364302d12b76e69e4f021f0bb1d2d50ed6/src/server/mcp/recall-mcp-server.ts#L115-L151","documentation":"Thrown by dispatchToolCall() in the recall MCP server when the requested tool `name` is not one of the supported read tools (search, context, recent). This is a read-only recall surface; mutating tools are intentionally absent. createRecallMcpServer converts this into an MCP error response.","triggerScenarios":"An MCP client invokes a tool name outside {search, context, recent}; a client cached an older/newer tool list that included a renamed or removed tool; a typo in the tool name; an attempt to call a write tool over the read-only recall endpoint.","commonSituations":"Client and server are version-skewed on the tool list. An LLM client invents a tool name. A user expects a `write`/`add` tool on the recall surface.","solutions":["Use only search, context, or recent as the tool name.","Re-fetch the tool list (ListToolsRequest) so the client reflects the current supported names.","If you need a mutating operation, use the write surface (not the read-only recall MCP server).","Check for typos/casing in the tool name."],"exampleFix":"// before: hallucinated tool name -> \"Unknown tool: write\"\nclient.callTool({ name: 'write', arguments: {...} });\n// after: use a supported read tool\nclient.callTool({ name: 'search', arguments: { projectId: 'p1', query: 'auth' } });","handlingStrategy":"type-guard","validationCode":"const RECALL_TOOLS = new Set(['search', 'context', 'recent']);\nfunction isKnownRecallTool(name: string): boolean {\n  return RECALL_TOOLS.has(name);\n}\n// before calling: if (!isKnownRecallTool(name)) surface a clear client error","typeGuard":"function isRecallToolName(name: string): name is 'search' | 'context' | 'recent' {\n  return name === 'search' || name === 'context' || name === 'recent';\n}","tryCatchPattern":"try {\n  result = await dispatchToolCall(backend, name, args);\n} catch (error) {\n  if (/Unknown tool/.test((error as Error).message)) {\n    // refresh the client's tool list (ListTools) and retry with a valid name\n    return makeMcpError(`Unknown tool: ${name}. Available: search, context, recent`);\n  }\n  throw error;\n}","preventionTips":["Always drive MCP tools from the server's ListTools response, not a hardcoded list.","Keep client and server versions in sync to avoid schema/name skew.","Remember the recall MCP server is read-only (search/context/recent)."],"tags":["mcp","recall","routing","validation"],"backgroundTag":null,"analyzedSha":"d768ba364302d12b76e69e4f021f0bb1d2d50ed6","analyzedAt":"2026-08-12T23:52:55.241Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}