tool_calls
Class info¶
Classes¶
| Name | Children | Inherits |
|---|---|---|
| AddDiffChange aclientp.schema.v2.tool_calls A file was added. |
||
| CancelToolCallRequest aclientp.schema.v2.tool_calls Parameters of ``tool_call/cancel``: cancel one tool call. |
||
| CancelToolCallResponse aclientp.schema.v2.tool_calls Response to ``tool_call/cancel``. |
||
| Content aclientp.schema.v2.tool_calls A standard content block (text, image, resource) produced by a tool call. |
||
| CopyDiffChange aclientp.schema.v2.tool_calls A file was copied. |
||
| DeleteDiffChange aclientp.schema.v2.tool_calls A file was deleted. |
||
| Diff aclientp.schema.v2.tool_calls File changes produced by a tool call. |
||
| DiffPatch aclientp.schema.v2.tool_calls Renderable patch text and its format. |
||
| ModifyDiffChange aclientp.schema.v2.tool_calls A file was modified in place. |
||
| MoveDiffChange aclientp.schema.v2.tool_calls A file was moved or renamed. |
||
| SessionReference aclientp.schema.v2.tool_calls A display-only reference to another session the tool call operates on, e.g. a subagent. |
||
| Terminal aclientp.schema.v2.tool_calls A display-only reference to an agent-owned terminal. |
||
| ToolCallCancelCapabilities aclientp.schema.v2.tool_calls The tool call can be cancelled with ``tool_call/cancel``. |
||
| ToolCallCapabilities aclientp.schema.v2.tool_calls Client-initiated controls a tool call currently supports. |
||
| ToolCallContentChunk aclientp.schema.v2.tool_calls A content item appended to a tool call's content. |
||
| ToolCallLocation aclientp.schema.v2.tool_calls A file location a tool reads or modifies, for "follow-along" features. |
||
| ToolCallUpdate aclientp.schema.v2.tool_calls A tool call upsert, keyed by ``tool_call_id``. |
||
| UnknownDiffChange aclientp.schema.v2.tool_calls A custom or future file operation; values starting with ``_`` are extensions. |
||
| UnknownToolCallContent aclientp.schema.v2.tool_calls Custom or future tool call content; ``type`` values starting with ``_`` are extensions. |
🛈 DocStrings¶
v2 tool calls: upserts, streamed content, diffs and cancellation.
tool_call_update is one upsert keyed by toolCallId (v1 had separate
tool_call and tool_call_update). Its fields are patches: omitted leaves a
value unchanged, None clears it. tool_call_content_chunk appends one content
item to a tool call.
DiffChange
module-attribute
¶
DiffChange = Annotated[
Annotated[AddDiffChange, Tag("add")]
| Annotated[DeleteDiffChange, Tag("delete")]
| Annotated[ModifyDiffChange, Tag("modify")]
| Annotated[MoveDiffChange, Tag("move")]
| Annotated[CopyDiffChange, Tag("copy")]
| Annotated[UnknownDiffChange, Tag(OTHER_TAG)],
Discriminator(
open_discriminator("operation", frozenset({"add", "delete", "modify", "move", "copy"}))
),
]
One file-level change of a :class:Diff.
DiffFileType
module-attribute
¶
Kind of file content of a diff change. Values starting with _ are extensions.
DiffPatchFormat
module-attribute
¶
Format of a diff patch; git_patch is diff --git sections in Git's --patch format.
ToolCallContent
module-attribute
¶
ToolCallContent = Annotated[
Annotated[Content, Tag("content")]
| Annotated[Diff, Tag("diff")]
| Annotated[Terminal, Tag("terminal")]
| Annotated[SessionReference, Tag("session")]
| Annotated[UnknownToolCallContent, Tag(OTHER_TAG)],
Discriminator(
open_discriminator("type", frozenset({"content", "diff", "terminal", "session"}))
),
]
Content produced by a tool call.
ToolCallStatus
module-attribute
¶
ToolCallStatus = (
Literal["pending", "in_progress", "paused", "completed", "failed", "cancelled"] | str
)
Execution status of a tool call. Values starting with _ are extensions.
ToolKind
module-attribute
¶
ToolKind = (
Literal[
"read",
"edit",
"delete",
"move",
"search",
"execute",
"think",
"fetch",
"switch_mode",
"other",
]
| str
)
Category of a tool, for icons and display. Values starting with _ are extensions.
AddDiffChange
¶
CancelToolCallRequest
¶
Bases: AnnotatedObject
Parameters of tool_call/cancel: cancel one tool call.
Only for tool calls that currently advertise capabilities.cancel.
Source code in src/aclientp/schema/v2/tool_calls.py
CancelToolCallResponse
¶
Bases: AnnotatedObject
Response to tool_call/cancel.
Source code in src/aclientp/schema/v2/tool_calls.py
Content
¶
Bases: AnnotatedObject
A standard content block (text, image, resource) produced by a tool call.
Source code in src/aclientp/schema/v2/tool_calls.py
CopyDiffChange
¶
DeleteDiffChange
¶
Diff
¶
Bases: AnnotatedObject
File changes produced by a tool call.
changes is authoritative for affected paths and operations; patch optionally
carries renderable text for some or all of them.
Source code in src/aclientp/schema/v2/tool_calls.py
changes
class-attribute
instance-attribute
¶
changes: Sequence[DiffChange] = Field(min_length=1)
The structured file changes; at least one.
DiffPatch
¶
Bases: AnnotatedObject
Renderable patch text and its format.
Source code in src/aclientp/schema/v2/tool_calls.py
ModifyDiffChange
¶
MoveDiffChange
¶
SessionReference
¶
Bases: AnnotatedObject
A display-only reference to another session the tool call operates on, e.g. a subagent.
Source code in src/aclientp/schema/v2/tool_calls.py
Terminal
¶
Bases: AnnotatedObject
A display-only reference to an agent-owned terminal.
State and output arrive separately as terminal_update and
terminal_output_chunk.
Source code in src/aclientp/schema/v2/tool_calls.py
ToolCallCancelCapabilities
¶
Bases: AnnotatedObject
The tool call can be cancelled with tool_call/cancel.
Source code in src/aclientp/schema/v2/tool_calls.py
ToolCallCapabilities
¶
Bases: AnnotatedObject
Client-initiated controls a tool call currently supports.
A malformed value counts as no controls.
Source code in src/aclientp/schema/v2/tool_calls.py
cancel
class-attribute
instance-attribute
¶
cancel: ToolCallCancelCapabilities | MISSING | None = MISSING
Permits tool_call/cancel for this tool call.
ToolCallContentChunk
¶
Bases: AnnotatedObject
A content item appended to a tool call's content.
Source code in src/aclientp/schema/v2/tool_calls.py
ToolCallLocation
¶
Bases: AnnotatedObject
A file location a tool reads or modifies, for "follow-along" features.
Source code in src/aclientp/schema/v2/tool_calls.py
line
class-attribute
instance-attribute
¶
1-based line number in the file; 0 is invalid.
ToolCallUpdate
¶
Bases: AnnotatedObject
A tool call upsert, keyed by tool_call_id.
Sent as the tool_call_update session update (:class:ToolCallSessionUpdate in
:mod:aclientp.schema.v2.session_updates), and embedded in tool call permission requests.
Source code in src/aclientp/schema/v2/tool_calls.py
capabilities
class-attribute
instance-attribute
¶
capabilities: ToolCallCapabilities | MISSING | None = MISSING
Controls the tool call currently supports, such as cancellation.
content
class-attribute
instance-attribute
¶
content: Sequence[ToolCallContent] | MISSING | None = MISSING
Content produced by the tool call; replaces earlier content.
kind
class-attribute
instance-attribute
¶
kind: ToolKind | MISSING | None = MISSING
Category of the tool.
locations
class-attribute
instance-attribute
¶
locations: Sequence[ToolCallLocation] | MISSING | None = MISSING
File locations affected by the tool call.
name
class-attribute
instance-attribute
¶
Programmatic name of the tool.
raw_input
class-attribute
instance-attribute
¶
Raw input parameters of the tool.
raw_output
class-attribute
instance-attribute
¶
Raw output of the tool.
status
class-attribute
instance-attribute
¶
status: ToolCallStatus | MISSING | None = MISSING
Execution status; None resets it to pending.
title
class-attribute
instance-attribute
¶
Human-readable title of what the tool is doing.
tool_call_id
instance-attribute
¶
tool_call_id: ToolCallId
Unique identifier of the tool call in the session.
UnknownDiffChange
¶
Bases: Unknown, _DiffChangeBase
A custom or future file operation; values starting with _ are extensions.