TencentCloud/TencentDB-Agent-Memory · error
Unknown tool: ${name}
Error message
Unknown tool: ${name} What it means
The MCP server's tool-call handler looks up request.params.name in toolMap, which is built from the registered tool endpoints. If the requested tool name is not registered, the handler logs a warning and returns an isError result with text 'Unknown tool: <name>' instead of throwing — the error text is the tool-call result returned to the MCP client.
Source
Thrown at MemoryKnowledge/src/mcp/server.ts:57
server.setRequestHandler(ListToolsRequestSchema, async () => {
return {
tools: MCP_TOOLS.map((t) => ({
name: t.name,
description: t.description,
inputSchema: t.inputSchema,
})),
};
});
// Call tool
server.setRequestHandler(CallToolRequestSchema, async (request) => {
const { name, arguments: args } = request.params;
const tool = toolMap.get(name);
if (!tool) {
log.warn(`Unknown tool requested: "${name}"`);
return {
content: [{ type: "text", text: `Unknown tool: ${name}` }],
isError: true,
};
}
const body = (args ?? {}) as Record<string, unknown>;
try {
const data = await callApi(httpOpts, tool.endpoint, body);
// The code-graph query endpoints return {text, isError} — pass through directly
if (data && typeof data === "object" && "text" in data && "isError" in data) {
const result = data as { text: string; isError: boolean };
return {
content: [{ type: "text", text: result.text || "(empty result)" }],
isError: result.isError,
};
}
// Other endpoints return structured data — serialize as JSON
return {View on GitHub (pinned to 3efcd317b8)
Solutions
- Call tools/list on the server and use an exact name from the response
- Fix the tool name spelling in the client request
- Restart/refresh the client so it re-fetches the current tool list
- If the tool should exist, register it in createMcpServer so it lands in toolMap
Example fix
// before
await client.callTool({ name: 'searchKnowledgebase', arguments: { q: 'x' } });
// after
const { tools } = await client.listTools();
await client.callTool({ name: 'search_knowledge_base', arguments: { q: 'x' } }); Defensive patterns
Strategy: validation
Validate before calling
const { tools } = await client.listTools();
if (!tools.some(t => t.name === toolName)) throw new Error(`Tool "${toolName}" not registered on this server`); Type guard
function isRegisteredTool(name: string, tools: { name: string }[]): name is string {
return tools.some(t => t.name === name);
} Try / catch
const result = await client.callTool({ name, arguments: args });
if (result.isError && result.content?.[0]?.text?.startsWith('Unknown tool:')) {
const { tools } = await client.listTools();
console.error(`"${name}" not found. Available: ${tools.map(t => t.name).join(', ')}`);
} Prevention
- Fetch tools/list before calling instead of hard-coding names
- Invalidate cached tool lists after server restarts/upgrades
- Verify tool registration in createMcpServer if a tool goes missing
When it happens
Trigger: A client sends tools/call with a name that is not in toolMap: typo in tool name, client cached a stale tool list after server tool set changed, or the tool was removed/renamed in server.ts while the client still references the old name.
Common situations: Client connected to an older server version exposing different tool names; hand-written MCP client calls with a mistyped tool name; multiple MCP servers running and the client sends a tool from one server to another.
Related errors
- ${TAG} ${path} envelope error ${env.code}: ${env.message ??
- Backend API error ${res.statusCode}: ${data}
AI-assisted analysis of TencentCloud/TencentDB-Agent-Memory@3efcd317b8 (2026-09-01).
Data as JSON: /api/errors/79576ad3c1c947e2.
Report an issue: GitHub.