MCP Tool Runner • AI Agent SDK
MCPToolRunner: A dedicated thread for running MCP operations.
MCPToolRunner
Defined in the MCP module.
AI Agent
A dedicated thread for running MCP operations.
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#8B0000', 'primaryTextColor': '#fff', 'primaryBorderColor': '#710101', 'lineColor': '#189AB4', 'secondaryColor': '#189AB4', 'tertiaryColor': '#fff' }}}%%
graph LR
agent["Agent"] -- "uses" --> tool["Tool: MCPToolRunner"]
tool -- "returns" --> result["Result"]
style tool fill:#189AB4,color:#fff
style agent fill:#8B0000,color:#fff
style result fill:#8B0000,color:#fffConstructor
ParamField
AnyNo description available.
ParamField
AnyNo description available.
Methods
run()
Main thread function that processes MCP requests.
read_resource()Read an MCP resource by URI and return its normalised contents.
get_prompt()Fetch an MCP prompt template rendered with `arguments`.
Call an MCP tool and wait for the result.
shutdown()Signal the thread to shut down.
stop()Best-effort teardown for the runner thread.
Source
View on GitHubpraisonaiagents/mcp/mcp.py at line 45