Created
December 4, 2025 03:20
-
-
Save KyMidd/fbb6263fa03a1db37cf2c891d647d12f to your computer and use it in GitHub Desktop.
After: MCPClient tool_filters parameter
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
| # MCPClient filters declaratively | |
| TOOLS_PREFIX = "github" | |
| READ_ONLY_PREFIXES = ["download_", "get_", "list_", "search_"] | |
| github_mcp_client = MCPClient( | |
| lambda: streamablehttp_client(...), | |
| tool_filters={ | |
| "allowed": [lambda tool: tool.tool_name.startswith(tuple( | |
| f"{TOOLS_PREFIX}_{p}" for p in READ_ONLY_PREFIXES | |
| ))] | |
| }, | |
| prefix=TOOLS_PREFIX, | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment