McpToolRegistrationService.AddToolServersToAgentAsync Method

Definition

Loads/initializes configured MCP tool servers for the specified agent with full context. This is the primary method that customers should use in orchestrators with full authentication context.

public System.Threading.Tasks.Task AddToolServersToAgentAsync(Azure.AI.Agents.Persistent.PersistentAgentsClient agentClient, Microsoft.Agents.Builder.App.UserAuth.UserAuthorization userAuthorization, string authHandlerName, Microsoft.Agents.Builder.ITurnContext turnContext, string? authToken = default);
abstract member AddToolServersToAgentAsync : Azure.AI.Agents.Persistent.PersistentAgentsClient * Microsoft.Agents.Builder.App.UserAuth.UserAuthorization * string * Microsoft.Agents.Builder.ITurnContext * string -> System.Threading.Tasks.Task
override this.AddToolServersToAgentAsync : Azure.AI.Agents.Persistent.PersistentAgentsClient * Microsoft.Agents.Builder.App.UserAuth.UserAuthorization * string * Microsoft.Agents.Builder.ITurnContext * string -> System.Threading.Tasks.Task
Public Function AddToolServersToAgentAsync (agentClient As PersistentAgentsClient, userAuthorization As UserAuthorization, authHandlerName As String, turnContext As ITurnContext, Optional authToken As String = Nothing) As Task

Parameters

agentClient
PersistentAgentsClient

The PersistentAgentsClient instance.

userAuthorization
UserAuthorization

User authorization context.

authHandlerName
String

Authentication Handler Name for use with the UserAuthorization System

turnContext
ITurnContext

Turn context for the conversation.

authToken
String

Optional auth token to access the MCP servers.

Returns

Implements

Applies to