CherryHQ/cherry-studio · error · McpError
ErrorCode.MethodNotFound
ErrorCode.MethodNotFound
Error message
Unknown tool: ${toolName} What it means
The AgentMemoryServer registers exactly one tool named 'memory' via ListToolsRequestSchema. The CallToolRequest handler throws McpError with ErrorCode.MethodNotFound for any request whose params.name is not 'memory'. This is the MCP protocol-correct way to reject unknown tools.
Source
Thrown at src/main/ai/mcp/servers/agentMemory.ts:150
tools: {}
}
}
)
this.setupHandlers()
}
private setupHandlers() {
this.mcpServer.server.setRequestHandler(ListToolsRequestSchema, async () => ({
tools: [MEMORY_TOOL]
}))
this.mcpServer.server.setRequestHandler(CallToolRequestSchema, async (request) => {
const toolName = request.params.name
const args = (request.params.arguments ?? {}) as Record<string, string | undefined>
try {
if (toolName !== 'memory') {
throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${toolName}`)
}
const action = args.action
switch (action) {
case 'update':
return await this.memoryUpdate(args)
case 'append':
return await this.memoryAppend(args)
case 'search':
return await this.memorySearch(args)
default:
throw new McpError(ErrorCode.InvalidParams, `Unknown action "${action}", expected update/append/search`)
}
} catch (error) {
const message = error instanceof Error ? error.message : String(error)
logger.error(`Tool error: ${toolName}`, { agentId: this.agentId, error: message })
return {
content: [{ type: 'text' as const, text: `Error: ${message}` }],
isError: trueView on GitHub (pinned to 726446b54c)
Solutions
- Call ListTools first and only invoke tool names that are advertised.
- Verify you are connected to the 'agent-memory' server and not another MCP server.
- Update the client to match the server's tool surface.
Example fix
// before
await server.callTool({ name: 'recall', arguments: {...} })
// after
const { tools } = await server.listTools()
const name = tools[0].name // 'memory'
await server.callTool({ name, arguments: { action: 'search', query: '...' } }) Defensive patterns
Strategy: validation
Validate before calling
// Client-side: only call tools the server advertises.
const { tools } = await client.listTools()
const allowed = new Set(tools.map((t) => t.name))
if (!allowed.has(toolName)) throw new Error(`Tool '${toolName}' not offered by agent-memory server`)
await client.callTool({ name: toolName, arguments }) Type guard
function isMemoryToolName(name: string): boolean {
return name === 'memory'
} Prevention
- Always call ListTools before CallTool to discover the live tool surface.
- Pin client and server versions so the tool set matches.
- Route tool calls to the correct MCP server, not the first available.
When it happens
Trigger: An MCP client sends a CallToolRequest with a tool name other than 'memory' to this server (e.g. a stale client that cached an older tool list, or a misrouted request intended for a different server).
Common situations: Client and server version mismatch where the client believes different tools exist; a generic MCP client enumerating tools by brute force; a bug in the MCP router dispatching the call to the wrong server instance.
Related errors
- MethodNotFound
- MethodNotFound
- MethodNotFound
- MethodNotFound
- Path traversal detected: target path must be direct child of
AI-assisted analysis of CherryHQ/cherry-studio@726446b54c (2026-08-12).
Data as JSON: /api/errors/c48d4f75e33641e3.
Report an issue: GitHub.