-
Notifications
You must be signed in to change notification settings - Fork 141
Add MCP server tool filtering support to agents-js #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ests feat(core): add tool filtering for MCP servers
…getalltools Fix RealtimeAgent tool fetching
…th-examples Add MCP tool filtering example
🦋 Changeset detectedLatest commit: 713f8e0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@seratch can you review please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for sending this! I haven't verified the actual behavior yet but let me share a few quick comments
Co-authored-by: Kazuhiro Sera <[email protected]>
Co-authored-by: Kazuhiro Sera <[email protected]>
…sts and server impl
thanks for the comments, @seratch! esp. the point about moving filtering logic that makes sense for keeping the server implementation focused on transport. |
- Moved tool filtering logic to agent/runner layer - Removed server-side filtering and context coupling - Updated test suite to reflect new behavior
Thanks @seratch. That makes sense and i’ve removed the |
Hey all - this PR brings a new tool filtering feature to our MCP integrations. This resolves #162 based on openai/openai-agents-python#861
You can now:
Use
createStaticToolFilter
for quick allow/block listsProvide a custom filter function to make dynamic decisions based on
runContext
Updated core API so
getAllTools
now accepts yourrunContext
, ensuring filters are applied correctlyDocumentation enhancements in
docs/guides/mcp.mdx
New example (
examples/mcp/tool-filter-example.ts
) to demonstrate both static and dynamic filteringComprehensive tests covering static lists, callable filters, multi-server hierarchies, and cache interactions
All tests pass and you can try it out by
pnpm -F mcp start:tool-filter