{"record":{"id":"4f6d160834c451de","repo":"CherryHQ/cherry-studio","slug":"methodnotfound-4f6d16","errorCode":"MethodNotFound","errorMessage":"Unknown tool: ${name}","messagePattern":"Unknown tool: (.+?)","errorType":"exception","errorClass":"McpError","httpStatus":null,"severity":"error","filePath":"src/main/ai/mcp/servers/memory.ts","lineNumber":694,"sourceCode":"            }\n          case 'search_nodes':\n            if (typeof args.query !== 'string') {\n              throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for ${name}: 'query' string is required.`)\n            }\n            return {\n              content: [{ type: 'text', text: JSON.stringify(await manager.searchNodes(args.query), null, 2) }]\n            }\n          case 'open_nodes':\n            if (!args.names || !Array.isArray(args.names)) {\n              throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for ${name}: 'names' array is required.`)\n            }\n            return {\n              content: [\n                { type: 'text', text: JSON.stringify(await manager.openNodes(args.names as string[]), null, 2) }\n              ]\n            }\n          default:\n            throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`)\n        }\n      } catch (error) {\n        // Catch errors from manager methods (like entity not found) or other issues\n        if (error instanceof McpError) {\n          throw error // Re-throw McpErrors directly\n        }\n        logger.error(`Error executing tool ${name}:`, error as Error)\n        // Throw a generic internal error for unexpected issues\n        throw new McpError(\n          ErrorCode.InternalError,\n          `Error executing tool ${name}: ${error instanceof Error ? error.message : String(error)}`\n        )\n      }\n    })\n  }\n}\n\nexport default MemoryServer","sourceCodeStart":676,"sourceCodeEnd":712,"githubUrl":"https://github.com/CherryHQ/cherry-studio/blob/726446b54cd69ffe51a276638672f6d95ca0768c/src/main/ai/mcp/servers/memory.ts#L676-L712","documentation":"The memory MCP server's CallTool handler reaches the `default` switch branch and throws McpError MethodNotFound with the offending tool name. This means the requested tool name does not match any handled case (`create_entities`, `create_relations`, `add_observations`, `delete_entities`, `delete_observations`, `delete_relations`, `read_graph`, `search_nodes`, `open_nodes`). It is a protocol-level error distinct from InvalidParams.","triggerScenarios":"Calling a tool name the server does not register: a typo, a deprecated name, or a name from a different server routed here by mistake.","commonSituations":"Version skew between client and server (tool renamed/removed); a typo in the tool name; the model hallucinates a tool name; routing a call to the wrong MCP server.","solutions":["Call `tools/list` first and use only names it returns.","Check for typos and version mismatches between the client and the memory server.","If you renamed a tool, update all call sites and redeploy both ends."],"exampleFix":"// before\n{ name: \"delete_entity\" /* typo */ }\n// after\n{ name: \"delete_entities\" }","handlingStrategy":"validation","validationCode":"const MEMORY_TOOLS = new Set([\n  'create_entities','create_relations','add_observations',\n  'delete_entities','delete_observations','delete_relations',\n  'read_graph','search_nodes','open_nodes'\n])\nfunction assertMemoryTool(name: string) {\n  if (!MEMORY_TOOLS.has(name)) throw new Error(`Unknown memory tool: ${name}. Call tools/list.`)\n}","typeGuard":"const isMemoryTool = (name: string): boolean => MEMORY_TOOLS.has(name)","tryCatchPattern":"try {\n  assertMemoryTool(name)\n  await client.callTool({ name, arguments })\n} catch (e) {\n  if (e instanceof McpError && e.code === ErrorCode.MethodNotFound) {\n    // refresh tools/list, fix the name, do NOT retry blindly\n  }\n  throw e\n}","preventionTips":["Discover tools via `tools/list` at startup; never hardcode without a source of truth.","Treat a MethodNotFound as version skew — refresh capabilities before retrying.","Validate the tool name before constructing the request payload."],"tags":["mcp","method-not-found","memory-server","routing"],"backgroundTag":null,"analyzedSha":"726446b54cd69ffe51a276638672f6d95ca0768c","analyzedAt":"2026-08-12T17:30:37.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}