-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Open
Copy link
Labels
.NETIssue or Pull requests regarding .NET codeIssue or Pull requests regarding .NET codebugSomething isn't workingSomething isn't working
Description
Describe the bug
I am adding tools to Semantic Kernel from MCP servers like this example:
IMcpClient mcpClient = await McpClientFactory.CreateAsync(
new SseClientTransport(new SseClientTransportOptions()
{
Endpoint = new Uri("https://mcp.notion.com/mcp"),
TransportMode = HttpTransportMode.StreamableHttp,
AdditionalHeaders = new Dictionary<string, string>
{
{ "Authorization", $"Bearer {token}" }
}
})
);
IList<McpClientTool> tools = await mcpClient.ListToolsAsync();
kernel.Plugins.AddFromFunctions(
tool.Name,
tools.Select(aiFunction => aiFunction.AsKernelFunction())
);
The MCP server has tools names using dash in it, eg: create-pages
And semantic kernel throws error:
Unhandled exception. System.ArgumentException: A plugin name can contain only ASCII letters, digits, and underscores: 'create-pages' is not a valid name. (Parameter 'name')
Is this a bug or how do I work around this?
To Reproduce
Steps to reproduce the behavior:
Run the snippet above
Expected behavior
Auto convert dash to underscores maybe?
Screenshots
Platform
- Language: C#
- Source: NuGet package version 1.61.0
- AI model: GPT-4o-mini
- IDE: VS Code
- OS: Mac
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
.NETIssue or Pull requests regarding .NET codeIssue or Pull requests regarding .NET codebugSomething isn't workingSomething isn't working
Type
Projects
Status
Bug