The outcome of a tools/call that the server completed.
A tool that fails reports it in-band: is_error: true with the failure in
content. That is still {:ok, %ToolResult{is_error: true}};
{:error, %ConduitMcp.Client.Error{}} is reserved for protocol, transport
and policy failures.
content- thecontentblocks, string-keyed, as sent.structured-structuredContent, ornil.is_error-truewhen the server sentisError: true(or, for a synthetic result, when a post-call hook failed and the result was withheld; seeConduitMcp.Client.Hooks).meta- the result's_meta, or%{}.extra- every other wire key (minusresultType), never atomized.provenance-nil, or, for a result shaped for a model (ConduitMcp.Client.Pipeline,shape: :llm),%{server_id: id, truncated: boolean, flags: [atom]}.
Summary
Functions
Builds a result from a wire CallToolResult map.
Types
Functions
@spec from_wire(term()) :: {:ok, t()} | {:error, ConduitMcp.Client.Error.t()}
Builds a result from a wire CallToolResult map.
content must be a list when present (a missing content reads as [])
and isError a boolean or null when present (null reads as false);
otherwise the result is a :protocol error with reason
:invalid_tool_result. resultType is not checked here: an MRTR interim
result never reaches this function.
iex> {:ok, result} =
...> ConduitMcp.Client.ToolResult.from_wire(%{
...> "content" => [%{"type" => "text", "text" => "boom"}],
...> "isError" => true
...> })
iex> result.is_error
true