feat(gateway): add tools_include and tools_exclude filters#4023
Open
ecthelion77 wants to merge 1 commit intoIBM:mainfrom
Open
feat(gateway): add tools_include and tools_exclude filters#4023ecthelion77 wants to merge 1 commit intoIBM:mainfrom
ecthelion77 wants to merge 1 commit intoIBM:mainfrom
Conversation
7875f55 to
5a21aff
Compare
Contributor
Author
|
Suggested labels: |
5a21aff to
b4f5ed9
Compare
2d99163 to
0853473
Compare
0853473 to
c7aa79b
Compare
c7aa79b to
b524955
Compare
Signed-off-by: Olivier Gintrand <olivier.gintrand@forterro.com>
b524955 to
9e98adc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✨ Feature / Enhancement PR
🔗 Epic / Issue
Closes #4021
🚀 Summary (1-2 sentences)
Add optional
tools_includeandtools_excludefields to gateways that filter which tools are imported from a remote MCP server using fnmatch glob patterns.🧪 Checks
make lintpasses (ruff + black)make testpasses📓 Notes
Use case
When connecting to a single MCP backend that exposes many tools (e.g. an ITSM API with 40+ endpoints), it is often useful to split it into multiple gateways with different tool subsets and different auth schemes:
tools_exclude: ["*project*"]) — OAuth authtools_include: ["*project*"]) — API key authFiltering logic
tools_includeis set, only tools whose name matches at least one include pattern are kepttools_excludeis set, tools matching any exclude pattern are removedPatterns use Python
fnmatchsyntax (*project*,manage-ticket*).Changes
db.pytools_include/tools_excludeJSON columns onGatewayschemas.pyGatewayCreate,GatewayUpdate,GatewayReadgateway_service.py_apply_tool_filters()+ 4 call sites (refresh, register, update, activate)export_service.pyimport_service.pyadmin.pyformSubmitHandlers.jsgateways.jsadmin.htmlIF NOT EXISTSguard)