diff options
Diffstat (limited to 'packages/core/src/tools/mcp-client.ts')
| -rw-r--r-- | packages/core/src/tools/mcp-client.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/core/src/tools/mcp-client.ts b/packages/core/src/tools/mcp-client.ts index bb92ab05..6dca8cea 100644 --- a/packages/core/src/tools/mcp-client.ts +++ b/packages/core/src/tools/mcp-client.ts @@ -305,6 +305,26 @@ async function connectAndDiscover( continue; } + const { includeTools, excludeTools } = mcpServerConfig; + const toolName = funcDecl.name; + + let isEnabled = false; + if (includeTools === undefined) { + isEnabled = true; + } else { + isEnabled = includeTools.some( + (tool) => tool === toolName || tool.startsWith(`${toolName}(`), + ); + } + + if (excludeTools?.includes(toolName)) { + isEnabled = false; + } + + if (!isEnabled) { + continue; + } + let toolNameForModel = funcDecl.name; // Replace invalid characters (based on 400 error message from Gemini API) with underscores |
