Checked on November 20, 2026 against
openai-agents 0.25.0 (Python) and @openai/agents 0.22.0 (TypeScript).Install
Hosted MCP tool
The model calls TronRental from OpenAI’s side. Ask for approval before any tool that changes something: read-only tools run by themselves, the rest go through your callback.hosted.py
authorization is sent to TronRental as Authorization: Bearer <value>: an API key, or an OAuth access token of the user. To narrow what the model sees, add "allowed_tools": ["quote_energy", "buy_energy", "get_order"].
Local MCP client
Your process connects to TronRental and hands the tools to the agent; the key never leaves your server.local.py
TypeScript
requireApproval other than "never", the run stops at tools that need approval and returns them in result.interruptions; approve them with result.state.approve(...) and run again with result.state.
For a local client in TypeScript, use new MCPServerStreamableHttp({ url, requestInit: { headers } }) from @openai/agents and pass it in mcpServers.
Responses API without the SDK
The hosted tool is the Responses API’smcp tool: