summaryrefslogtreecommitdiff
path: root/packages/core/src/tools/mcp-client.ts
diff options
context:
space:
mode:
authorJordan Demeulenaere <[email protected]>2025-07-07 18:34:26 +0200
committerGitHub <[email protected]>2025-07-07 16:34:26 +0000
commit355fb4ac676820ebcca76c985284798dc40ed653 (patch)
tree467de15e37549974cbaaf8ebfe737b7086b4893e /packages/core/src/tools/mcp-client.ts
parentaa8e5776eb491dffa4e539afdc75798bfc4a904d (diff)
Add excludeTools and includeTools to mcpServers config (#2976)
Diffstat (limited to 'packages/core/src/tools/mcp-client.ts')
-rw-r--r--packages/core/src/tools/mcp-client.ts20
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