Table of Contents

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

inputType Type

An array of Type objects representing the input parameter types.

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

outputType Type

The Type of the output object.

description string

A description of the output.

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

type Type

The Type to check.

Returns

bool

true if the type is a primitive type; otherwise, false.