Skip to content

feat: allow filtering exposed tools#4

Merged
mKeRix merged 2 commits into
mainfrom
allow-filtering-mcp-tools
Nov 30, 2025
Merged

feat: allow filtering exposed tools#4
mKeRix merged 2 commits into
mainfrom
allow-filtering-mcp-tools

Conversation

@mKeRix

@mKeRix mKeRix commented Nov 30, 2025

Copy link
Copy Markdown
Owner

This will allow users to filter the tools exposed by an MCP server with include and exclude rules, giving them the option to target what the AI will use even if the underlying MCP server does not offer this functionality.

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @mKeRix, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new feature that enables granular control over the tools exposed by Model Context Protocol (MCP) servers. Users can now define includeTools and excludeTools lists within their server configurations, allowing them to precisely manage which tools are made available to an AI, even if the underlying server provides a broader set of functionalities. This enhancement provides greater flexibility and control over AI interactions with external tools.

Highlights

  • Tool Filtering Configuration: New includeTools and excludeTools options are added to server configurations (stdio, http, sse) to allow users to specify which tools an AI should use.
  • Filtering Logic Implementation: A new utility function, shouldIncludeTool, is introduced to apply the filtering rules, where includeTools acts as a whitelist and excludeTools as a blacklist, with exclusions taking precedence.
  • Server Aggregator Integration: The ServerAggregator now reads and applies these tool filters during initialization, ensuring only permitted tools are exposed.
  • Comprehensive Testing: Dedicated unit tests have been added to validate the correctness of the tool filtering logic under various scenarios.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov-commenter

codecov-commenter commented Nov 30, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 57.14286% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.61%. Comparing base (b92f9a4) to head (7fb47fa).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/gateway/aggregator.ts 10.00% 18 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #4      +/-   ##
==========================================
+ Coverage   52.50%   52.61%   +0.10%     
==========================================
  Files          32       33       +1     
  Lines        2272     2313      +41     
  Branches      136      142       +6     
==========================================
+ Hits         1193     1217      +24     
- Misses       1079     1096      +17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a valuable feature for filtering tools from MCP servers. The implementation is well-structured, with the core filtering logic correctly isolated in its own file and accompanied by a comprehensive suite of tests. The changes to the configuration schema and types are clear and consistent. I've provided a few suggestions to improve performance and code clarity. Overall, this is a solid contribution.

Comment thread src/gateway/aggregator.ts Outdated
Comment thread src/gateway/aggregator.ts Outdated
Comment thread src/gateway/tool-filter.ts
@mKeRix mKeRix merged commit bd1d64c into main Nov 30, 2025
1 check passed
@mKeRix mKeRix deleted the allow-filtering-mcp-tools branch November 30, 2025 22:44
github-actions Bot pushed a commit that referenced this pull request Dec 1, 2025
# 1.0.0 (2025-12-01)

### Features

* add config merging ([#5](#5)) ([4d58cb7](4d58cb7))
* add semantic tool search ([#2](#2)) ([cac523b](cac523b))
* allow filtering exposed tools ([#4](#4)) ([bd1d64c](bd1d64c))
* implement code mode ([#1](#1)) ([b3c4646](b3c4646))
* initial commit ([5477138](5477138))
* support oauth2 protected mcp servers ([#3](#3)) ([f5408d1](f5408d1))
github-actions Bot pushed a commit that referenced this pull request Dec 1, 2025
# 1.0.0 (2025-12-01)

### Features

* add config merging ([#5](#5)) ([4d58cb7](4d58cb7))
* add semantic tool search ([#2](#2)) ([cac523b](cac523b))
* allow filtering exposed tools ([#4](#4)) ([bd1d64c](bd1d64c))
* implement code mode ([#1](#1)) ([b3c4646](b3c4646))
* initial commit ([5477138](5477138))
* support oauth2 protected mcp servers ([#3](#3)) ([f5408d1](f5408d1))
@github-actions

github-actions Bot commented Dec 1, 2025

Copy link
Copy Markdown

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants