McpToolRegistrationService Class
Provides MCP tool registration services for Agent Framework agents.
This service handles registration and management of MCP (Model Context Protocol) tool servers with Agent Framework agents.
Initialize the MCP Tool Registration Service for Agent Framework.
Constructor
McpToolRegistrationService(logger: Logger | None = None)
Parameters
| Name | Description |
|---|---|
|
logger
|
Logger instance for logging operations. Default value: None
|
Methods
| add_tool_servers_to_agent |
Add MCP tool servers to a chat agent (mirrors .NET implementation). |
| cleanup |
Clean up any resources used by the service. |
add_tool_servers_to_agent
Add MCP tool servers to a chat agent (mirrors .NET implementation).
async add_tool_servers_to_agent(chat_client: OpenAIChatClient | AzureOpenAIChatClient, agent_instructions: str, initial_tools: List[Any], auth: Authorization, auth_handler_name: str, turn_context: TurnContext, auth_token: str | None = None) -> ChatAgent | None
Parameters
| Name | Description |
|---|---|
|
chat_client
Required
|
The chat client instance (Union[OpenAIChatClient, AzureOpenAIChatClient]) |
|
agent_instructions
Required
|
Instructions for the agent behavior |
|
initial_tools
Required
|
List of initial tools to add to the agent |
|
auth
Required
|
Authorization context for token exchange |
|
auth_handler_name
Required
|
Name of the authorization handler. |
|
turn_context
Required
|
Turn context for the operation |
|
auth_token
|
Optional bearer token for authentication Default value: None
|
Returns
| Type | Description |
|---|---|
|
ChatAgent instance with MCP tools registered, or None if creation failed |
cleanup
Clean up any resources used by the service.
async cleanup()