callTool

suspend fun callTool(name: String, arguments: Map<String, Any?>, compatibility: Boolean = false, options: RequestOptions? = null): CallToolResultBase?(source)

Calls a tool on the server by name, passing the specified arguments.

Return

The result of the tool call, or null if none.

Parameters

name

The name of the tool to call.

arguments

A map of argument names to values for the tool.

compatibility

Whether to use compatibility mode for older protocol versions.

options

Optional request options.

Throws

If the server does not support tools.


suspend fun callTool(request: CallToolRequest, compatibility: Boolean = false, options: RequestOptions? = null): CallToolResultBase?(source)

Calls a tool on the server using a CallToolRequest object.

Return

The result of the tool call, or null if none.

Parameters

request

The request object containing the tool name and arguments.

compatibility

Whether to use compatibility mode for older protocol versions.

options

Optional request options.

Throws

If the server does not support tools.