Skip to content

Conversation

@PederHP
Copy link
Collaborator

@PederHP PederHP commented Mar 31, 2025

Addresses #154 by providing utility to clone McpClientTool with a new name or description. This will mostly be useful for hosts that need to be robust against user-configurable MCP servers (to avoid name conflicts by prefixing with the server name) and for hosts that use MCP servers known at development time where evaluation pipelines have shown that the name and/or descriptions of tools do not result in acceptable tool calling accuracy.

This could be used like this:

if (myExamples.ContainsKey(tool.Name))
{
  tool = tool.WithDescription(tool.Description + "\n\nExample Usage:\n" + myExamples[tool.Name]);
}

or

return tools.Select(tool => tool.WithName($"{client.ServerInfo.Name}_{tool.Name}"));

@PederHP PederHP requested a review from stephentoub March 31, 2025 19:05
Copy link
Contributor

@halter73 halter73 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I'm not a huge fan of "With" methods outside of builder types, I don't have a better alternative at the moment😄

@eiriktsarpalis
Copy link
Member

While I'm not a huge fan of "With" methods outside of builder types, I don't have a better alternative at the moment😄

I think using With is perfectly fine in the context of immutable persistable updates, C# records use the with keyword for essentially the same thing.

Copy link
Member

@eiriktsarpalis eiriktsarpalis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@halter73 halter73 merged commit 4ecb6bc into modelcontextprotocol:main Apr 2, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants