Tool

A tool the server exposes for the model to call.

Members

Functions

forVersion
Tool forVersion(ProtocolVersion v)

Return a copy of this Tool with any fields newer than (or absent from) the negotiated protocol version stripped, so the wire output stays valid for the peer's version. Tool.execution (ToolExecution.taskSupport) exists ONLY in the 2025-11-25 schema: it was never present before 2025-11-25 and was dropped again in the draft schema. It is therefore emitted only when the negotiated version is exactly 2025-11-25, and omitted for every other version (including draft). Mirrors Implementation.forVersion.

toolAnnotations
ToolAnnotations toolAnnotations()

Parse the raw annotations Json into a typed ToolAnnotations on demand. The struct stores annotations as untyped Json (so unknown hint keys survive a round-trip); this accessor lazily decodes the known hints via ToolAnnotations.fromJson, returning a default (all-null) ToolAnnotations when annotations is not an object.

withToolAnnotations
Tool withToolAnnotations(ToolAnnotations a)

Fluent typed setter mirroring toolAnnotations(): encodes a typed ToolAnnotations into the raw annotations Json so callers never have to hand-build the .toJson() themselves (symmetric with the typed Resource/ResourceTemplate.annotations write path). An empty ToolAnnotations clears the field (leaves it Json.undefined), so it is omitted from the serialized form. The raw-Json storage is unchanged, so unknown annotation keys set via annotations directly still round-trip.

Variables

annotations
Json annotations;

optional ToolAnnotations

execution
Nullable!ToolExecution execution;

optional per-tool task-augmented execution descriptor (2025-11-25)

icons
Icon[] icons;

optional icons for display in user interfaces

inputSchema
Json inputSchema;

JSON Schema (object); defaults to empty object schema

outputSchema
Json outputSchema;

optional JSON Schema for structured results

Mixed In Members

From mixin MetaField

meta
Json meta;

optional _meta object