CallToolResult

data class CallToolResult(val content: List<ContentBlock>, val isError: Boolean? = null, val structuredContent: JsonObject? = null, val meta: JsonObject? = null) : ServerResult(source)

The server's response to a CallToolRequest.

Contains the result of the tool execution, which can be successful or an error.

Important error handling:

  • Errors that originate from the tool itself SHOULD be reported inside the result object with isError set to true, NOT as an MCP protocol-level error response. This allows the LLM to see that an error occurred and potentially self-correct.

  • Errors in finding the tool, unsupported operations, or other exceptional conditions SHOULD be reported as MCP protocol-level error responses.

Constructors

Link copied to clipboard
constructor(content: List<ContentBlock>, isError: Boolean? = null, structuredContent: JsonObject? = null, meta: JsonObject? = null)

Properties

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

A list of content blocks that represent the unstructured result of the tool call. This is what the LLM will see as the tool's output.

Link copied to clipboard

Whether the tool call ended in an error. If not set, this is assumed to be false (the call was successful). When true, the content should describe the error that occurred.

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

Optional metadata for this response.

Link copied to clipboard

An optional JSON object that represents the structured result of the tool call. Provides machine-readable output in addition to the human-readable content.