Creating Custom Tools
Basic Example
using realvirtual.MCP;
public static class MyTools
{
[McpTool("Get current time")]
public static string GetTime()
{
return $"{{\"time\":\"{System.DateTime.Now}\"}}";
}
[McpTool("Add two numbers")]
public static string Add(
[McpParam("First number")] float a,
[McpParam("Second number")] float b)
{
return $"{{\"result\":{a + b}}}";
}
}Attributes
McpTool
McpParam
Rules
Helper Utilities
Example: Custom Sensor Tool
Last updated