Skip to content

RunContextWrapper in MCP server tools #1383

@sonhm3029

Description

@sonhm3029

I want to know if the mcp server tools write by myself can receive the RunContextWrapper in Agent sdk.

Without mcp server:

agent = Agent(tools=[....])
result = await Runner.run(context=UserInfo(...))

@function_tool:
def test(ctx: RunContextWrapper[UserInfo]):
      .....

With mcp server

@mcp.tool()
def test()
===> Can I access the runcontext wrapper here

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions