Raxol.AgentClientProtocol.Schema.ToolCall (Raxol Agent Client Protocol v0.1.0)

Copy Markdown View Source

Represents a tool call that the language model has requested. Every other type ported from tool_call.ex (ToolKind, ToolCallStatus, ToolCallLocation, Diff, ToolCallTerminal, ToolCallContentWrapper, ToolCallContent, ToolCallUpdateFields, ToolCallUpdate) is a separate, bare Schema.* module, not nested under this one.

kind and status default (:other / :pending) rather than erroring on an unrecognized wire value; content and locations default to [] and skip items that individually fail to decode.

Ported from the MIT f1729/agent_client_protocol (c) 2025 f1729; see NOTICE.md.

Summary

Functions

Total: never raises. Missing/non-string toolCallId or title is the only failure mode (the two required fields); everything else defaults leniently per the schema.

Project this ToolCall down to a ToolCallUpdate carrying its full current state.

Apply a partial update, overwriting only the fields present (non-nil) in fields.

Types

t()

@type t() :: %Raxol.AgentClientProtocol.Schema.ToolCall{
  _meta: map(),
  content: [Raxol.AgentClientProtocol.Schema.ToolCallContent.t()],
  kind: Raxol.AgentClientProtocol.Schema.ToolKind.t(),
  locations: [Raxol.AgentClientProtocol.Schema.ToolCallLocation.t()],
  raw_input: term() | nil,
  raw_output: term() | nil,
  status: Raxol.AgentClientProtocol.Schema.ToolCallStatus.t(),
  title: String.t(),
  tool_call_id: String.t()
}

Functions

from_json(map)

@spec from_json(term()) :: {:ok, t()} | {:error, term()}

Total: never raises. Missing/non-string toolCallId or title is the only failure mode (the two required fields); everything else defaults leniently per the schema.

new(tool_call_id, title)

@spec new(String.t(), String.t()) :: t()

to_json(tc)

@spec to_json(t()) :: map()

to_update(tc)

Project this ToolCall down to a ToolCallUpdate carrying its full current state.

update(tc, fields)

Apply a partial update, overwriting only the fields present (non-nil) in fields.