callTool

suspend fun callTool(name: String, arguments: Map<String, Any?>, meta: Map<String, Any?> = emptyMap(), options: RequestOptions? = null): CallToolResult(source)

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

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.

meta

A map of metadata key-value pairs. Keys must follow MCP specification format. - Optional prefix: dot-separated labels followed by slash (e.g., "api.example.com/") - Name: alphanumeric start/end, may contain hyphens, underscores, dots, alphanumerics - Reserved prefixes starting with "mcp" or "modelcontextprotocol" are forbidden

options

Optional request options.

Throws

If the server does not support tools.


suspend fun callTool(request: CallToolRequest, options: RequestOptions? = null): CallToolResult(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.

options

Optional request options.

Throws

If the server does not support tools.