ToolResult

data class ToolResult(val isSuccess: Boolean, val data: Map<String, Any?>?, val errorMessage: String?)

The outcome of an McpTool.execute call. Exactly one of data / errorMessage is meaningful, selected by isSuccess. The protocol layer maps a result onto the MCP tools/call response: success becomes content, failure becomes an isError: true payload.

Construct via the success / error factories rather than the primary constructor.

Constructors

Link copied to clipboard
constructor(isSuccess: Boolean, data: Map<String, Any?>?, errorMessage: String?)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val data: Map<String, Any?>?

Result map on success; its keys are part of the tool's wire contract. Null on failure.

Link copied to clipboard

Failure description on error; null on success. See the error overloads for the prose vs. short-form (code: detail) conventions.

Link copied to clipboard

Whether the tool completed its work.