-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Description
I'm running the sample https://github.com/microsoft/Agent365-Samples/tree/main/dotnet/agent-framework/sample-agent and could not get the Mcp tools to work.
I got the error below, seems like the method
Agent365-dotnet/src/Tooling/Extensions/AgentFramework/Services/McpToolRegistrationService.cs
Lines 114 to 119 in 9d2f7e2
| public async Task<IList<AITool>> GetMcpToolsAsync( | |
| string agentUserId, | |
| UserAuthorization userAuthorization, | |
| string authHandlerName, | |
| ITurnContext turnContext, | |
| string? authToken = null) |
Microsoft.Agents.A365.Tooling.Extensions.AgentFramework.Services.IMcpToolRegistrationService[0]
Failed to load tools from MCP server 'mcp_MailTools': Failed to get tools from MCP server 'mcp_MailTools' at 'https://agent365.svc.cloud.microsoft/agents/servers/mcp_MailTools': Failed to create MCP client for endpoint 'https://agent365.svc.cloud.microsoft/agents/servers/mcp_MailTools': The CancellationTokenSource has been disposed.
Object name: 'System.Threading.CancellationTokenSource'.
System.InvalidOperationException: Failed to get tools from MCP server 'mcp_MailTools' at 'https://agent365.svc.cloud.microsoft/agents/servers/mcp_MailTools': Failed to create MCP client for endpoint 'https://agent365.svc.cloud.microsoft/agents/servers/mcp_MailTools': The CancellationTokenSource has been disposed.
Object name: 'System.Threading.CancellationTokenSource'.
---> System.InvalidOperationException: Failed to create MCP client for endpoint 'https://agent365.svc.cloud.microsoft/agents/servers/mcp_MailTools': The CancellationTokenSource has been disposed.
Object name: 'System.Threading.CancellationTokenSource'.
---> System.ObjectDisposedException: The CancellationTokenSource has been disposed.
Object name: 'System.Threading.CancellationTokenSource'.
at ModelContextProtocol.Client.StreamableHttpClientSessionTransport.DisposeAsync()
at ModelContextProtocol.Client.AutoDetectingClientSessionTransport.InitializeAsync(JsonRpcMessage message, CancellationToken cancellationToken)
at ModelContextProtocol.McpSession.SendRequestAsync(JsonRpcRequest request, CancellationToken cancellationToken)
at ModelContextProtocol.McpEndpointExtensions.SendRequestAsync[TParameters,TResult](IMcpEndpoint endpoint, String method, TParameters parameters, JsonTypeInfo`1 parametersTypeInfo, JsonTypeInfo`1 resultTypeInfo, RequestId requestId, CancellationToken cancellationToken)
at ModelContextProtocol.Client.McpClient.ConnectAsync(CancellationToken cancellationToken)
at ModelContextProtocol.Client.McpClient.ConnectAsync(CancellationToken cancellationToken)
at ModelContextProtocol.Client.McpClientFactory.CreateAsync(IClientTransport clientTransport, McpClientOptions clientOptions, ILoggerFactory loggerFactory, CancellationToken cancellationToken)
at ModelContextProtocol.Client.McpClientFactory.CreateAsync(IClientTransport clientTransport, McpClientOptions clientOptions, ILoggerFactory loggerFactory, CancellationToken cancellationToken)
at Microsoft.Agents.A365.Tooling.Services.McpToolServerConfigurationService.CreateMcpClientWithAuthHandlers(ITurnContext turnContext, Uri endpoint, String clientName, String authToken) in C:\__w\1\s\Agent365-dotnet\src\Tooling\Core\Services\McpToolServerConfigurationService.cs:line 432
--- End of inner exception stack trace ---
at Microsoft.Agents.A365.Tooling.Services.McpToolServerConfigurationService.CreateMcpClientWithAuthHandlers(ITurnContext turnContext, Uri endpoint, String clientName, String authToken) in C:\__w\1\s\Agent365-dotnet\src\Tooling\Core\Services\McpToolServerConfigurationService.cs:line 436
at Microsoft.Agents.A365.Tooling.Services.McpToolServerConfigurationService.GetMcpClientToolsAsync(ITurnContext turnContext, MCPServerConfig mCPServerConfig, String authToken) in C:\__w\1\s\Agent365-dotnet\src\Tooling\Core\Services\McpToolServerConfigurationService.cs:line 74
--- End of inner exception stack trace ---
at Microsoft.Agents.A365.Tooling.Services.McpToolServerConfigurationService.GetMcpClientToolsAsync(ITurnContext turnContext, MCPServerConfig mCPServerConfig, String authToken) in C:\__w\1\s\Agent365-dotnet\src\Tooling\Core\Services\McpToolServerConfigurationService.cs:line 91
at Microsoft.Agents.A365.Tooling.Extensions.AgentFramework.Services.McpToolRegistrationService.GetMcpToolsAsync(String agentUserId, UserAuthorization userAuthorization, String authHandlerName, ITurnContext turnContext, String authToken) in C:\__w\1\s\Agent365-dotnet\src\Tooling\Extensions\AgentFramework\Services\McpToolRegistrationService.cs:line 142
Expected behavior
The async methods should accept a cancellation token that is passed along the async call chain
SDK Version
0.1.72-beta
.NET Version
.net8.0
OS
Windows 11
How to Reproduce
run the sample
Output
No response
Screenshots
No response
Code of Conduct
- I agree to follow the Microsoft Open Source Code of Conduct.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels