McpToolRegistrationService class
Discover MCP servers and list tools formatted for the OpenAI Agents SDK. Uses listToolServers to fetch server configs.
Methods
| add |
Registers MCP tool servers and updates agent options with discovered tools and server configs. Call this to enable dynamic OpenAI tool access based on the current MCP environment. |
Method Details
addToolServersToAgent(Agent<unknown, "text">, Authorization, string, TurnContext, string)
Registers MCP tool servers and updates agent options with discovered tools and server configs. Call this to enable dynamic OpenAI tool access based on the current MCP environment.
function addToolServersToAgent(agent: Agent<unknown, "text">, authorization: Authorization, authHandlerName: string, turnContext: TurnContext, authToken: string): Promise<Agent<unknown, "text">>
Parameters
- agent
-
Agent<unknown, "text">
The OpenAI Agent instance to which MCP servers will be added.
- authorization
- Authorization
Authorization object for token exchange.
- authHandlerName
-
string
The name of the auth handler to use for token exchange.
- turnContext
- TurnContext
The TurnContext of the current request.
- authToken
-
string
Optional bearer token for MCP server access.
Returns
Promise<Agent<unknown, "text">>
The updated Agent instance with registered MCP servers.