CherryHQ/cherry-studio · error · McpError
MethodNotFound
MethodNotFound
Error message
Unknown tool: ${name} What it means
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.
Source
Thrown at src/main/ai/mcp/servers/memory.ts:694
}
case 'search_nodes':
if (typeof args.query !== 'string') {
throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for ${name}: 'query' string is required.`)
}
return {
content: [{ type: 'text', text: JSON.stringify(await manager.searchNodes(args.query), null, 2) }]
}
case 'open_nodes':
if (!args.names || !Array.isArray(args.names)) {
throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for ${name}: 'names' array is required.`)
}
return {
content: [
{ type: 'text', text: JSON.stringify(await manager.openNodes(args.names as string[]), null, 2) }
]
}
default:
throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`)
}
} catch (error) {
// Catch errors from manager methods (like entity not found) or other issues
if (error instanceof McpError) {
throw error // Re-throw McpErrors directly
}
logger.error(`Error executing tool ${name}:`, error as Error)
// Throw a generic internal error for unexpected issues
throw new McpError(
ErrorCode.InternalError,
`Error executing tool ${name}: ${error instanceof Error ? error.message : String(error)}`
)
}
})
}
}
export default MemoryServerView on GitHub (pinned to 726446b54c)
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.
Example fix
// before
{ name: "delete_entity" /* typo */ }
// after
{ name: "delete_entities" } Defensive patterns
Strategy: validation
Validate before calling
const MEMORY_TOOLS = new Set([
'create_entities','create_relations','add_observations',
'delete_entities','delete_observations','delete_relations',
'read_graph','search_nodes','open_nodes'
])
function assertMemoryTool(name: string) {
if (!MEMORY_TOOLS.has(name)) throw new Error(`Unknown memory tool: ${name}. Call tools/list.`)
} Type guard
const isMemoryTool = (name: string): boolean => MEMORY_TOOLS.has(name)
Try / catch
try {
assertMemoryTool(name)
await client.callTool({ name, arguments })
} catch (e) {
if (e instanceof McpError && e.code === ErrorCode.MethodNotFound) {
// refresh tools/list, fix the name, do NOT retry blindly
}
throw e
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
AI-assisted analysis of CherryHQ/cherry-studio@726446b54c (2026-08-12).
Data as JSON: /api/errors/4f6d160834c451de.
Report an issue: GitHub.