Share via


McpToolRegistrationService Class

Provides services related to tools in the Semantic Kernel.

This service handles registration and management of MCP (Model Context Protocol) tool servers with Semantic Kernel agents.

Initialize the MCP Tool Registration Service for Semantic Kernel.

Constructor

McpToolRegistrationService(logger: Logger | None = None)

Parameters

Name Description
logger

Logger instance for logging operations.

Default value: None

Methods

add_tool_servers_to_agent

Adds the A365 MCP Tool Servers to the specified kernel.

cleanup_connections

Clean up all connected MCP plugins.

add_tool_servers_to_agent

Adds the A365 MCP Tool Servers to the specified kernel.

async add_tool_servers_to_agent(kernel: Kernel, auth: Authorization, auth_handler_name: str, context: TurnContext, auth_token: str | None = None) -> None

Parameters

Name Description
kernel
Required

The Semantic Kernel instance to which the tools will be added.

auth
Required

Authorization handler for token exchange.

auth_handler_name
Required

Name of the authorization handler.

context
Required

Turn context for the current operation.

auth_token

Authentication token to access the MCP servers.

Default value: None

Exceptions

Type Description

If kernel is None or required parameters are invalid.

If there's an error connecting to or configuring MCP servers.

cleanup_connections

Clean up all connected MCP plugins.

async cleanup_connections() -> None