From 6fbb1043804702f2a530ff25ca24c374f1a680a0 Mon Sep 17 00:00:00 2001 From: Ajax Davis Date: Sat, 17 Jan 2026 09:21:32 +1000 Subject: [PATCH] fix(mcp): use actual tool name from DB instead of parsed name The tool name shortening logic was correctly finding the tool in the database but then passing the reconstructed parsed.toolName (which may have an incorrect 'Tool' suffix) to the executor instead of using the actual tool name from the database record. This caused 'tool not found' errors when executing tools via MCP SSE even though the tools were listed correctly. --- apps/web/src/lib/mcp/handlers.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/web/src/lib/mcp/handlers.ts b/apps/web/src/lib/mcp/handlers.ts index 7a81a0a..d4b9a58 100644 --- a/apps/web/src/lib/mcp/handlers.ts +++ b/apps/web/src/lib/mcp/handlers.ts @@ -238,9 +238,10 @@ export async function handleToolsCall( // Use caller-provided env vars if given (non-owner), otherwise use collection's stored env vars const effectiveEnvVars = callerEnvVars ?? (collection?.envVars as Record) ?? {}; // Pass explicit version to avoid Deno HTTP import cache issues with @latest + // Use actual tool name from DB, not parsed name (which may have wrong suffix) const result = await executeWithExecutor(executorConfig, { packageName: actualPackageName, - name: parsed.toolName, + name: collectionTool.tool.name, version: actualVersion, params: params.arguments ?? {}, env: Object.keys(effectiveEnvVars).length > 0 ? effectiveEnvVars : undefined,