{"record":{"id":"a0195ae986de1d70","repo":"CherryHQ/cherry-studio","slug":"unknown-tool-name-a0195a","errorCode":null,"errorMessage":"Unknown tool: ${name}","messagePattern":"Unknown tool: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/ai/mcp/servers/filesystem/server.ts","lineNumber":107,"sourceCode":"            return await handleLsTool(args, this.baseDir)\n\n          case 'grep':\n            return await handleGrepTool(args, this.baseDir)\n\n          case 'read':\n            return await handleReadTool(args, this.baseDir)\n\n          case 'edit':\n            return await handleEditTool(args, this.baseDir)\n\n          case 'write':\n            return await handleWriteTool(args, this.baseDir)\n\n          case 'delete':\n            return await handleDeleteTool(args, this.baseDir)\n\n          default:\n            throw new Error(`Unknown tool: ${name}`)\n        }\n      } catch (error) {\n        const errorMessage = error instanceof Error ? error.message : String(error)\n        logger.error(`Tool execution error for ${request.params.name}:`, { error })\n        return {\n          content: [{ type: 'text', text: `Error: ${errorMessage}` }],\n          isError: true\n        }\n      }\n    })\n  }\n}\n\nexport default FileSystemServer\n","sourceCodeStart":89,"sourceCodeEnd":122,"githubUrl":"https://github.com/CherryHQ/cherry-studio/blob/726446b54cd69ffe51a276638672f6d95ca0768c/src/main/ai/mcp/servers/filesystem/server.ts#L89-L122","documentation":"Default branch of the filesystem server's tool dispatch switch. Reached when request.params.name is not glob/ls/grep/read/edit/write/delete. Unlike the fetch server, the handler is wrapped in try/catch (server.ts:80-117) so this throw is converted into an isError tool result, not a transport error. It signals that the client called a tool the server never advertised in ListTools.","triggerScenarios":"An MCP client sends a CallToolRequest with a name outside the seven registered tools — a typo, a future/legacy tool name, or a name belonging to a different MCP server the client is confusing this with.","commonSituations":"Client built against an older or newer server version that had a different tool set; a model inventing a tool name like 'move' or 'copy' that was never implemented; orchestrator routing a request to the wrong server.","solutions":["Verify the called name is exactly one of: glob, ls, grep, read, edit, write, delete (lowercase, no prefix).","Have the client re-fetch the tool list via ListTools before dispatching, rather than trusting a stale cache.","When adding/removing tools, keep the ListTools array (server.ts:65-77) and the switch cases in lockstep."],"exampleFix":"// before\ndefault:\n  throw new Error(`Unknown tool: ${name}`)\n\n// after — record the miss so version skew is diagnosable\nconst KNOWN = ['glob','ls','grep','read','edit','write','delete']\ndefault:\n  logger.warn('Unknown tool called', { name, known: KNOWN })\n  throw new Error(`Unknown tool: ${name}. Available: ${KNOWN.join(', ')}`)","handlingStrategy":"validation","validationCode":"// Validate the tool name against the registered filesystem tools.\nconst FS_TOOLS = new Set(['glob', 'ls', 'grep', 'read', 'edit', 'write', 'delete'])\nfunction isFsTool(name: unknown): name is string {\n  return typeof name === 'string' && FS_TOOLS.has(name)\n}","typeGuard":"function isKnownFsTool(name: string): boolean {\n  return ['glob', 'ls', 'grep', 'read', 'edit', 'write', 'delete'].includes(name)\n}","tryCatchPattern":null,"preventionTips":["Refresh the client's tool list via ListTools before dispatching.","Keep the ListTools array and the switch cases in server.ts in lockstep when adding/removing tools.","Bump the server version when the tool set changes so clients can detect drift.","Log unknown-tool calls so version skew between client and server is visible."],"tags":["mcp-tool","dispatch","filesystem"],"backgroundTag":null,"analyzedSha":"726446b54cd69ffe51a276638672f6d95ca0768c","analyzedAt":"2026-08-12T17:30:37.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}