diff options
Diffstat (limited to 'packages/core/src/tools/mcp-client.ts')
| -rw-r--r-- | packages/core/src/tools/mcp-client.ts | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/packages/core/src/tools/mcp-client.ts b/packages/core/src/tools/mcp-client.ts index 5849884d..7e6b11c1 100644 --- a/packages/core/src/tools/mcp-client.ts +++ b/packages/core/src/tools/mcp-client.ts @@ -277,16 +277,13 @@ export async function discoverTools( continue; } - const toolNameForModel = generateValidName(funcDecl, mcpServerName); - discoveredTools.push( new DiscoveredMCPTool( mcpCallableTool, mcpServerName, - toolNameForModel, + funcDecl.name!, funcDecl.description ?? '', funcDecl.parametersJsonSchema ?? { type: 'object', properties: {} }, - funcDecl.name!, mcpServerConfig.timeout ?? MCP_DEFAULT_TIMEOUT_MSEC, mcpServerConfig.trust, ), @@ -428,26 +425,6 @@ export function createTransport( } /** Visible for testing */ -export function generateValidName( - funcDecl: FunctionDeclaration, - mcpServerName: string, -) { - // Replace invalid characters (based on 400 error message from Gemini API) with underscores - let validToolname = funcDecl.name!.replace(/[^a-zA-Z0-9_.-]/g, '_'); - - // Prepend MCP server name to avoid conflicts with other tools - validToolname = mcpServerName + '__' + validToolname; - - // If longer than 63 characters, replace middle with '___' - // (Gemini API says max length 64, but actual limit seems to be 63) - if (validToolname.length > 63) { - validToolname = - validToolname.slice(0, 28) + '___' + validToolname.slice(-32); - } - return validToolname; -} - -/** Visible for testing */ export function isEnabled( funcDecl: FunctionDeclaration, mcpServerName: string, |
