Class McpToolJsonHelper
- Namespace
- nanoFramework.WebServer.Mcp
- Assembly
- nanoFramework.WebServer.Mcp.dll
Provides utility methods for generating JSON schemas that describe the input and output parameters of tools.
public static class McpToolJsonHelper
- Inheritance
-
McpToolJsonHelper
- Inherited Members
Remarks
This class includes methods for creating JSON representations of input and output schemas, including parameter names, types, and descriptions. It is designed to assist in dynamically generating metadata for tools or APIs.
Methods
GenerateInputJson(Type)
Generates a JSON array describing the input parameters for a tool, including their names, types, and descriptions.
public static string GenerateInputJson(Type inputType)
Parameters
Returns
- string
A JSON string representing the input parameters schema.
GenerateOutputJson(Type, string)
Generates a JSON object describing the output schema for a tool, including type, description, and nested properties if applicable.
public static string GenerateOutputJson(Type outputType, string description)
Parameters
Returns
- string
A JSON string representing the output schema.
IsPrimitiveType(Type)
Checks if the specified Type is a primitive type.
public static bool IsPrimitiveType(Type type)
Parameters
Returns
- bool
trueif the type is a primitive type; otherwise,false.