pub struct Tool {
pub meta: Option<Map<String, Value>>,
pub annotations: Option<ToolAnnotations>,
pub description: Option<String>,
pub icons: Option<Vec<Icon>>,
pub input_schema: ToolInputSchema,
pub name: String,
pub output_schema: Option<ToolOutputSchema>,
pub title: Option<String>,
}Expand description
Definition for a tool the client can call.
Fields§
§meta: Option<Map<String, Value>>§annotations: Option<ToolAnnotations>Optional additional tool information.
Display name precedence order is: title, annotations.title, then name.
description: Option<String>A human-readable description of the tool.
This can be used by clients to improve the LLM’s understanding of available tools. It can be thought of like a “hint” to the model.
icons: Option<Vec<Icon>>Optional set of sized icons that the client can display in a user interface.
Clients that support rendering icons MUST support at least the following MIME types:
image/png- PNG images (safe, universal compatibility)image/jpeg(andimage/jpg) - JPEG images (safe, universal compatibility)
Clients that support rendering icons SHOULD also support:
image/svg+xml- SVG images (scalable but requires security precautions)image/webp- WebP images (modern, efficient format)
input_schema: ToolInputSchemaA JSON Schema object defining the expected parameters for the tool.
Tool arguments are always JSON objects, so type: "object" is required at the root.
Beyond that, any JSON Schema 2020-12 keyword may appear alongside type — including
composition keywords (oneOf, anyOf, allOf, not), conditional keywords
(if/then/else), reference keywords ($ref, $defs, $anchor), and any other
standard validation or annotation keywords.
Property schemas may carry an x-mcp-header annotation to mirror the
argument value into an HTTP header on the Streamable HTTP transport. See
the Streamable HTTP transport specification for the validity and
extraction rules.
Defaults to JSON Schema 2020-12 when no explicit $schema is provided.
name: StringIntended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn’t present).
output_schema: Option<ToolOutputSchema>An optional JSON Schema object defining the structure of the tool’s output returned in
the structuredContent field of a CallToolResult. This can be any valid JSON Schema 2020-12.
Defaults to JSON Schema 2020-12 when no explicit $schema is provided.
title: Option<String>Intended for UI and end-user contexts — optimized to be human-readable and easily understood, even by those unfamiliar with domain-specific terminology.
If not provided, the name should be used for display (except for Tool,
where annotations.title should be given precedence over using name,
if present).