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.
This commit is contained in:
Ajax Davis 2026-01-17 09:21:32 +10:00
parent 9ebb5ee02e
commit 6fbb104380

View file

@ -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<string, string>) ?? {};
// 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,