Define an MCP Tool using [McpTool]
masterTo expose a .NET method as an MCP tool, create a class and decorate the method with the [McpTool] attribute. You can also use [McpParameter] to provide metadata like descriptions and requirement status for individual parameters. Note that [McpFunction] is deprecated; use [McpTool] instead.
using MCPSharp;
public class Calculator
{
[McpTool("add", "Adds two numbers")]
public static int Add([McpParameter(true)] int a, [McpParameter(true)] int b)
{
return a + b;
}
}