Tool

data class Tool(val name: String, val inputSchema: ToolSchema, val description: String? = null, val outputSchema: ToolSchema? = null, val title: String? = null, val annotations: ToolAnnotations? = null, val icons: List<Icon>? = null, val meta: JsonObject? = null) : WithMeta(source)

Definition for a tool the client can call.

Tools allow servers to expose functionality that can be invoked by clients and LLMs. Each tool has a name, description, and schema defining its input (and optionally output) parameters.

Display name precedence order: titleannotations.titlename

Constructors

Link copied to clipboard
constructor(name: String, inputSchema: ToolSchema, description: String? = null, outputSchema: ToolSchema? = null, title: String? = null, annotations: ToolAnnotations? = null, icons: List<Icon>? = null, meta: JsonObject? = null)

Properties

Link copied to clipboard
open val _meta: JsonObject
Link copied to clipboard

Optional additional tool information providing hints about tool behavior. All properties in ToolAnnotations are hints and not guaranteed to provide a faithful description of tool behavior.

Link copied to clipboard

A human-readable description of the tool and when to use it. Clients can use this to improve the LLM's understanding of available tools. It can be thought of like a "hint" to the model.

Link copied to clipboard
val icons: List<Icon>?

Optional set of sized icons that clients can display in their user interface. Clients MUST support at least PNG and JPEG formats. Clients SHOULD also support SVG and WebP formats.

Link copied to clipboard

A JSON Schema object defining the expected parameters for the tool. Must be an object type schema. Defines what arguments the tool accepts.

Link copied to clipboard
@SerialName(value = "_meta")
open override val meta: JsonObject?

Optional metadata for this tool.

Link copied to clipboard

The programmatic identifier for this tool. Intended for logical use and API identification. Used as a display name fallback if both title and annotations.title are not provided.

Link copied to clipboard

An optional JSON Schema object defining the structure of the tool's output returned in the structuredContent field of a CallToolResult. Must be an object type schema if provided.

Link copied to clipboard

Optional human-readable display name for this tool. Intended for UI and end-user contexts, optimized to be easily understood even by those unfamiliar with domain-specific terminology. Note: For Tool specifically, annotations.title takes precedence over this field.