McpToolServerConfigurationService.EnumerateToolsFromServersAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| EnumerateToolsFromServersAsync(String, String, ITurnContext, ToolOptions) |
Enumerates all MCP tools from configured servers for a given agent. |
| EnumerateToolsFromServersAsync(String, String, IMcpTokenProvider, ITurnContext, ToolOptions) |
Enumerates all MCP tools from configured servers, acquiring per-audience tokens for each server.
V2 servers (distinct audience) receive audience-scoped tokens via |
EnumerateToolsFromServersAsync(String, String, ITurnContext, ToolOptions)
Enumerates all MCP tools from configured servers for a given agent.
public virtual System.Threading.Tasks.Task<(System.Collections.Generic.List<Microsoft.Agents.A365.Tooling.Models.MCPServerConfig> Servers, System.Collections.Generic.Dictionary<string,System.Collections.Generic.IList<ModelContextProtocol.Client.McpClientTool>> ToolsByServer)> EnumerateToolsFromServersAsync(string agentInstanceId, string authToken, Microsoft.Agents.Builder.ITurnContext turnContext, Microsoft.Agents.A365.Tooling.Models.ToolOptions toolOptions);
abstract member EnumerateToolsFromServersAsync : string * string * Microsoft.Agents.Builder.ITurnContext * Microsoft.Agents.A365.Tooling.Models.ToolOptions -> System.Threading.Tasks.Task<ValueTuple<System.Collections.Generic.List<Microsoft.Agents.A365.Tooling.Models.MCPServerConfig>, System.Collections.Generic.Dictionary<string, System.Collections.Generic.IList<ModelContextProtocol.Client.McpClientTool>>>>
override this.EnumerateToolsFromServersAsync : string * string * Microsoft.Agents.Builder.ITurnContext * Microsoft.Agents.A365.Tooling.Models.ToolOptions -> System.Threading.Tasks.Task<ValueTuple<System.Collections.Generic.List<Microsoft.Agents.A365.Tooling.Models.MCPServerConfig>, System.Collections.Generic.Dictionary<string, System.Collections.Generic.IList<ModelContextProtocol.Client.McpClientTool>>>>
Public Overridable Function EnumerateToolsFromServersAsync (agentInstanceId As String, authToken As String, turnContext As ITurnContext, toolOptions As ToolOptions) As Task(Of ValueTuple(Of List(Of MCPServerConfig), Dictionary(Of String, IList(Of McpClientTool))))
Parameters
- agentInstanceId
- String
The agent instance ID.
- authToken
- String
Authentication token for MCP server access.
- turnContext
- ITurnContext
Turn context for the current request.
- toolOptions
- ToolOptions
Tool options including user agent configuration.
Returns
A tuple containing server configurations and a dictionary mapping server names to their available tools.
Implements
Applies to
EnumerateToolsFromServersAsync(String, String, IMcpTokenProvider, ITurnContext, ToolOptions)
Enumerates all MCP tools from configured servers, acquiring per-audience tokens for each server.
V2 servers (distinct audience) receive audience-scoped tokens via tokenProvider;
V1 servers fall back to authToken.
public virtual System.Threading.Tasks.Task<(System.Collections.Generic.List<Microsoft.Agents.A365.Tooling.Models.MCPServerConfig> Servers, System.Collections.Generic.Dictionary<string,System.Collections.Generic.IList<ModelContextProtocol.Client.McpClientTool>> ToolsByServer)> EnumerateToolsFromServersAsync(string agentInstanceId, string authToken, Microsoft.Agents.A365.Tooling.Services.IMcpTokenProvider tokenProvider, Microsoft.Agents.Builder.ITurnContext turnContext, Microsoft.Agents.A365.Tooling.Models.ToolOptions toolOptions);
abstract member EnumerateToolsFromServersAsync : string * string * Microsoft.Agents.A365.Tooling.Services.IMcpTokenProvider * Microsoft.Agents.Builder.ITurnContext * Microsoft.Agents.A365.Tooling.Models.ToolOptions -> System.Threading.Tasks.Task<ValueTuple<System.Collections.Generic.List<Microsoft.Agents.A365.Tooling.Models.MCPServerConfig>, System.Collections.Generic.Dictionary<string, System.Collections.Generic.IList<ModelContextProtocol.Client.McpClientTool>>>>
override this.EnumerateToolsFromServersAsync : string * string * Microsoft.Agents.A365.Tooling.Services.IMcpTokenProvider * Microsoft.Agents.Builder.ITurnContext * Microsoft.Agents.A365.Tooling.Models.ToolOptions -> System.Threading.Tasks.Task<ValueTuple<System.Collections.Generic.List<Microsoft.Agents.A365.Tooling.Models.MCPServerConfig>, System.Collections.Generic.Dictionary<string, System.Collections.Generic.IList<ModelContextProtocol.Client.McpClientTool>>>>
Public Overridable Function EnumerateToolsFromServersAsync (agentInstanceId As String, authToken As String, tokenProvider As IMcpTokenProvider, turnContext As ITurnContext, toolOptions As ToolOptions) As Task(Of ValueTuple(Of List(Of MCPServerConfig), Dictionary(Of String, IList(Of McpClientTool))))
Parameters
- agentInstanceId
- String
The agent instance ID.
- authToken
- String
Shared authentication token (V1 fallback).
- tokenProvider
- IMcpTokenProvider
Provides per-server Bearer tokens, routing V2 servers to audience-scoped tokens.
- turnContext
- ITurnContext
Turn context for the current request.
- toolOptions
- ToolOptions
Tool options including user agent configuration.
Returns
A tuple containing server configurations and a dictionary mapping server names to their available tools.