Skip to content

Conversation

@sevakva
Copy link
Contributor

@sevakva sevakva commented Nov 19, 2025

This PR fixes an issue in MCPServer where run_context and agent parameters were required for all tool filtering scenarios, even when using static tool filtering that doesn't need them.

The fix moves the validation check for run_context and agent from the caller level into the dynamic filter branch of _apply_tool_filter.

@sevakva sevakva changed the title fix: enforce required parameters for dynamic tool filtering in MCPServer fix: allow static tool filtering without agent and run_context in MCPServer Nov 19, 2025
@seratch
Copy link
Member

seratch commented Nov 20, 2025

The _apply_tool_filter method always receives those parameters, so I don't see the necessity of this change. Can you elaborate more on the context?

@seratch seratch marked this pull request as draft November 20, 2025 01:12
@sevakva
Copy link
Contributor Author

sevakva commented Nov 20, 2025

The _apply_tool_filter method always receives those parameters, so I don't see the necessity of this change. Can you elaborate more on the context?

Hey @seratch
We have a need to create MCPServer before agent run and have it globally. Then we call .list_tools() method to construct a global list of tools on startup, so frontend can fetch it.
Calling this method outside of the agent run with static filter causing an error

@seratch
Copy link
Member

seratch commented Nov 20, 2025

Ah, I see. This makes sense.

@seratch seratch marked this pull request as ready for review November 20, 2025 06:58
@seratch seratch added the bug Something isn't working label Nov 20, 2025
@seratch seratch added this to the 0.6.x milestone Nov 20, 2025
@seratch seratch merged commit 0dae2f0 into openai:main Nov 20, 2025
9 checks passed
@mukul-atomicwork
Copy link

mukul-atomicwork commented Nov 24, 2025

Temporal Implementation of this also calls without context and an agent. Because of this, it wasn't possible to make tool filtering through temporal impl. Thanks for fixing this @sevakva .

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

Labels

bug Something isn't working feature:mcp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants