addTool

Registers a single tool. The client can then call this tool.

Parameters

tool

A Tool object describing the tool.

handler

A suspend function that handles executing the tool when called by the client.

Throws

If the server does not support tools.


fun addTool(name: String, description: String, inputSchema: ToolSchema = ToolSchema(), title: String? = null, outputSchema: ToolSchema? = null, toolAnnotations: ToolAnnotations? = null, execution: ToolExecution? = null, meta: JsonObject? = null, handler: suspend ClientConnection.(CallToolRequest) -> CallToolResult)(source)

Registers a single tool. The client can then call this tool.

Parameters

name

The name of the tool.

description

A human-readable description of what the tool does.

inputSchema

The expected input schema for the tool.

title

An optional human-readable name of the tool for display purposes.

outputSchema

The optional expected output schema for the tool.

toolAnnotations

Optional additional tool information.

execution

Optional execution-related properties, such as task-augmented execution support.

meta

Optional metadata as a JsonObject.

handler

A suspend function that handles executing the tool when called by the client.

Throws

If the server does not support tools.