Table of Contents

Class Tool

Namespace
ModelContextProtocol.Protocol
Assembly
ModelContextProtocol.Core.dll

Represents a tool that the server is capable of calling.

public class Tool
Inheritance
Tool
Inherited Members

Properties

Annotations

Gets or sets optional additional tool information and behavior hints.

[JsonPropertyName("annotations")]
public ToolAnnotations? Annotations { get; set; }

Property Value

ToolAnnotations

Remarks

These annotations provide metadata about the tool's behavior, such as whether it's read-only, destructive, idempotent, or operates in an open world. They also can include a human-readable title. Note that these are hints and should not be relied upon for security decisions.

Description

Gets or sets a human-readable description of the tool.

[JsonPropertyName("description")]
public string? Description { get; set; }

Property Value

string

Remarks

This description helps the AI model understand what the tool does and when to use it. It should be clear, concise, and accurately describe the tool's purpose and functionality.

The description is typically presented to AI models to help them determine when and how to use the tool based on user requests.

InputSchema

Gets or sets a JSON Schema object defining the expected parameters for the tool.

[JsonPropertyName("inputSchema")]
public JsonElement InputSchema { get; set; }

Property Value

JsonElement

Remarks

The schema must be a valid JSON Schema object with the "type" property set to "object". This is enforced by validation in the setter which will throw an ArgumentException if an invalid schema is provided.

The schema typically defines the properties (parameters) that the tool accepts, their types, and which ones are required. This helps AI models understand how to structure their calls to the tool.

If not explicitly set, a default minimal schema of {"type":"object"} is used.

Name

Gets or sets the name of the tool.

[JsonPropertyName("name")]
public string Name { get; set; }

Property Value

string