Add Option to Exclude Specific MCP Tools from Context Window #3475
Replies: 7 comments
-
I just looked through the repository because of this and found this request. My MCP servers are adding 50k+ tokens. One is a MCP server that contains 100 functions, but i only ever use like 4 of them. Please give us a way to create allowlists or blocklists for MCP server functions. |
Beta Was this translation helpful? Give feedback.
-
The best option to manage this is to give users the option to improve the system prompt Pls see Kilo-Org/kilocode#449 Coz it's, let's say, might be a bit improved. I'm ok to do any of this, and ok to use Roo or Kilo, coz for my chores, the extensions are the same I had to get the approval from the maintainers first (which is reasonable), and in both projects, the maintainers do not have time for this, even just to decline this idea, pick it up by themselves, or give me a green light to implement that. |
Beta Was this translation helpful? Give feedback.
-
This discussion points to the same problem with the system prompt. |
Beta Was this translation helpful? Give feedback.
-
Apparently this is already sort of finished, it is just waiting final review and merging i think But yes i agree, more configuration options for the system prompt in general would be great. |
Beta Was this translation helpful? Give feedback.
-
@user425846 thank you for the implementation. Hope that this discussion will be noticed one day |
Beta Was this translation helpful? Give feedback.
-
Btw as a workaround, i am now using https://github.com/metatool-ai/metatool-app?tab=readme-ov-file It acts as a proxy for all your mcp servers and you can activate and deactivate individual tools |
Beta Was this translation helpful? Give feedback.
-
@user425846 Amazing! Thank you for the link. Will it be too much if I say that I love you? 🤣 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is your feature request related to a problem? Please describe.
When connecting an MCP server, all available tools are included in the context window, which can clutter it and consume unnecessary tokens. For example, I might only need 1-2 tools (e.g., GitHub MCP for basic repository mapping), but others like web search or advanced file operations are included, impacting performance.
Describe the solution you'd like
Add a configuration option to exclude specific MCP tools from being exposed to the model. For instance, a
filter
key tomcp.json
file and later (maybe) a settings UI where users can list tools to skip (e.g.,web_search
,file_system_advanced
). This would reduce context window usage and improve efficiency.Describe alternatives you've considered
Manually disabling tools via custom MCP server configurations, but this is cumbersome and not user-friendly for quick toggling.
Additional context
Example: When using GitHub MCP, I only need
repo_map
andissue_fetch
but notpull_request_create
. Excluding the latter would save tokens.Note
I’m happy to implement this feature and submit a PR if the team finds it reasonable and worth merging.
Screenshots or Mockups
N/A
UPD:
After a while, I understand that adding support in the templates in the system prompts files will be even better, keeping the existing functionality as it is and just extending the editor.
Works only if the user provides the
.roo/.{slug-name}-system-prompt.mustache
file (the templating framework can be discussed, it's just the simplest choice)If such a file is provided, then the default system prompt is empty, completely empty. All the hassle about system prompt generation is on the user.
In the template, we forward the context with all the prompt-related context variables.
User writes his/her system prompt, picking ONLY the things which are related to the specific mode.
Why:
There is plenty of duplication in the current prompt implementation
The ability to pick ONLY the desired MCP tools. For example, the user may want to only use the commit tool from the git MCP, but the server will give him the list of 30 tools (and all of that is happening in the most valuable spot - the start of the context)
Such things as a detailed OS version or the current time can be part of the system prompt without the MCP or user prompt.
Some embedded tools are explained in a verbose tone for my taste, and it was in there for a reason, because it was done a while ago with the thought that it might be used by small models too. But the current SOTA models can comprehend shorter versions.
But the implementation should be relatively straightforward
Beta Was this translation helpful? Give feedback.
All reactions