Skip to content

[BUG]: MCP Server unecessarily requires use of Agent and RunContext #976

Open
@njbrake

Description

@njbrake

Describe the bug

Found while working on mozilla-ai/any-agent#543

PR #861 added support for tool filtering. I'm in favor of a tool filtering feature being added, but the way it was implemented now requires that you access any tools from an MCP after creating the Agent, which is an unnecessary new design restriction.

Our library already had logic to filter tools,

which first listed the tools https://github.com/mozilla-ai/any-agent/blob/main/src/any_agent/tools/mcp/frameworks/openai.py#L47

and then filtered them https://github.com/mozilla-ai/any-agent/blob/main/src/any_agent/tools/mcp/mcp_connection.py#L40.

This was all done before passing the list of tools to the Agent.

Debug information

  • Agents SDK version: 0.1.0
  • Python version 3.13

Repro steps

MCP list_tools now requires a run context and an agent.

Expected behavior

I'd prefer if this filtering feature was implemented without the change to the parameters passed into list_tools.

However, at a minimum (and maybe at least for the short term) could they be optional parameters since they're only used when using the built in openai filtering logic?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions