Skip to content

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

                                      DiffFileType = Literal['text', 'binary', 'directory', 'symlink'] | str
                                      

                                      Kind of file content of a diff change. Values starting with _ are extensions.

                                      DiffPatchFormat module-attribute

                                      DiffPatchFormat = Literal['git_patch'] | str
                                      

                                      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

                                      Bases: _PathChange

                                      A file was added.

                                      Source code in src/aclientp/schema/v2/tool_calls.py
                                      class AddDiffChange(_PathChange):
                                          """A file was added."""
                                      
                                          operation: Literal["add"] = Field(default="add", init=False)
                                      

                                      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
                                      class CancelToolCallRequest(AnnotatedObject):
                                          """Parameters of ``tool_call/cancel``: cancel one tool call.
                                      
                                          Only for tool calls that currently advertise ``capabilities.cancel``.
                                          """
                                      
                                          session_id: SessionId
                                          """The session that owns the tool call."""
                                      
                                          tool_call_id: ToolCallId
                                          """The tool call to cancel."""
                                      

                                      session_id instance-attribute

                                      session_id: SessionId
                                      

                                      The session that owns the tool call.

                                      tool_call_id instance-attribute

                                      tool_call_id: ToolCallId
                                      

                                      The tool call to cancel.

                                      CancelToolCallResponse

                                      Bases: AnnotatedObject

                                      Response to tool_call/cancel.

                                      Source code in src/aclientp/schema/v2/tool_calls.py
                                      class CancelToolCallResponse(AnnotatedObject):
                                          """Response to ``tool_call/cancel``."""
                                      

                                      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
                                      class Content(AnnotatedObject):
                                          """A standard content block (text, image, resource) produced by a tool call."""
                                      
                                          type: Literal["content"] = Field(default="content", init=False)
                                      
                                          content: ContentBlock
                                          """The content block."""
                                      

                                      content instance-attribute

                                      content: ContentBlock
                                      

                                      The content block.

                                      CopyDiffChange

                                      Bases: _PathPairChange

                                      A file was copied.

                                      Source code in src/aclientp/schema/v2/tool_calls.py
                                      class CopyDiffChange(_PathPairChange):
                                          """A file was copied."""
                                      
                                          operation: Literal["copy"] = Field(default="copy", init=False)
                                      

                                      DeleteDiffChange

                                      Bases: _PathChange

                                      A file was deleted.

                                      Source code in src/aclientp/schema/v2/tool_calls.py
                                      class DeleteDiffChange(_PathChange):
                                          """A file was deleted."""
                                      
                                          operation: Literal["delete"] = Field(default="delete", init=False)
                                      

                                      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
                                      class Diff(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.
                                          """
                                      
                                          type: Literal["diff"] = Field(default="diff", init=False)
                                      
                                          changes: Sequence[DiffChange] = Field(min_length=1)
                                          """The structured file changes; at least one."""
                                      
                                          patch: DiffPatch | MISSING | None = MISSING
                                          """Renderable patch text; agents SHOULD provide it whenever feasible."""
                                      

                                      changes class-attribute instance-attribute

                                      changes: Sequence[DiffChange] = Field(min_length=1)
                                      

                                      The structured file changes; at least one.

                                      patch class-attribute instance-attribute

                                      patch: DiffPatch | MISSING | None = MISSING
                                      

                                      Renderable patch text; agents SHOULD provide it whenever feasible.

                                      DiffPatch

                                      Bases: AnnotatedObject

                                      Renderable patch text and its format.

                                      Source code in src/aclientp/schema/v2/tool_calls.py
                                      class DiffPatch(AnnotatedObject):
                                          """Renderable patch text and its format."""
                                      
                                          format: DiffPatchFormat
                                          """The patch format; ACP defines only ``git_patch``."""
                                      
                                          text: str
                                          """The patch text."""
                                      

                                      format instance-attribute

                                      The patch format; ACP defines only git_patch.

                                      text instance-attribute

                                      text: str
                                      

                                      The patch text.

                                      ModifyDiffChange

                                      Bases: _PathChange

                                      A file was modified in place.

                                      Source code in src/aclientp/schema/v2/tool_calls.py
                                      class ModifyDiffChange(_PathChange):
                                          """A file was modified in place."""
                                      
                                          operation: Literal["modify"] = Field(default="modify", init=False)
                                      

                                      MoveDiffChange

                                      Bases: _PathPairChange

                                      A file was moved or renamed.

                                      Source code in src/aclientp/schema/v2/tool_calls.py
                                      class MoveDiffChange(_PathPairChange):
                                          """A file was moved or renamed."""
                                      
                                          operation: Literal["move"] = Field(default="move", init=False)
                                      

                                      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
                                      class SessionReference(AnnotatedObject):
                                          """A display-only reference to another session the tool call operates on, e.g. a subagent."""
                                      
                                          type: Literal["session"] = Field(default="session", init=False)
                                      
                                          session_id: SessionId
                                          """The referenced session."""
                                      

                                      session_id instance-attribute

                                      session_id: SessionId
                                      

                                      The referenced session.

                                      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
                                      class Terminal(AnnotatedObject):
                                          """A display-only reference to an agent-owned terminal.
                                      
                                          State and output arrive separately as ``terminal_update`` and
                                          ``terminal_output_chunk``.
                                          """
                                      
                                          type: Literal["terminal"] = Field(default="terminal", init=False)
                                      
                                          terminal_id: TerminalId
                                          """The terminal to display."""
                                      

                                      terminal_id instance-attribute

                                      terminal_id: TerminalId
                                      

                                      The terminal to display.

                                      ToolCallCancelCapabilities

                                      Bases: AnnotatedObject

                                      The tool call can be cancelled with tool_call/cancel.

                                      Source code in src/aclientp/schema/v2/tool_calls.py
                                      class ToolCallCancelCapabilities(AnnotatedObject):
                                          """The tool call can be cancelled with ``tool_call/cancel``."""
                                      

                                      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
                                      class ToolCallCapabilities(AnnotatedObject):
                                          """Client-initiated controls a tool call currently supports.
                                      
                                          A malformed value counts as no controls.
                                          """
                                      
                                          cancel: ToolCallCancelCapabilities | MISSING | None = MISSING
                                          """Permits ``tool_call/cancel`` for this tool call."""
                                      

                                      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
                                      class ToolCallContentChunk(AnnotatedObject):
                                          """A content item appended to a tool call's content."""
                                      
                                          session_update: Literal["tool_call_content_chunk"] = Field(
                                              default="tool_call_content_chunk", init=False
                                          )
                                      
                                          tool_call_id: ToolCallId
                                          """The tool call the content belongs to."""
                                      
                                          content: ToolCallContent
                                          """The appended content item."""
                                      

                                      content instance-attribute

                                      content: ToolCallContent
                                      

                                      The appended content item.

                                      tool_call_id instance-attribute

                                      tool_call_id: ToolCallId
                                      

                                      The tool call the content belongs to.

                                      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
                                      class ToolCallLocation(AnnotatedObject):
                                          """A file location a tool reads or modifies, for "follow-along" features."""
                                      
                                          path: AbsolutePath
                                          """The absolute file path."""
                                      
                                          line: int | MISSING | None = Field(default=MISSING, ge=1)
                                          """1-based line number in the file; ``0`` is invalid."""
                                      

                                      line class-attribute instance-attribute

                                      line: int | MISSING | None = Field(default=MISSING, ge=1)
                                      

                                      1-based line number in the file; 0 is invalid.

                                      path instance-attribute

                                      The absolute file path.

                                      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
                                      class ToolCallUpdate(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.
                                          """
                                      
                                          tool_call_id: ToolCallId
                                          """Unique identifier of the tool call in the session."""
                                      
                                          name: str | MISSING | None = MISSING
                                          """Programmatic name of the tool."""
                                      
                                          title: str | MISSING | None = MISSING
                                          """Human-readable title of what the tool is doing."""
                                      
                                          kind: ToolKind | MISSING | None = MISSING
                                          """Category of the tool."""
                                      
                                          status: ToolCallStatus | MISSING | None = MISSING
                                          """Execution status; ``None`` resets it to ``pending``."""
                                      
                                          content: Sequence[ToolCallContent] | MISSING | None = MISSING
                                          """Content produced by the tool call; replaces earlier content."""
                                      
                                          locations: Sequence[ToolCallLocation] | MISSING | None = MISSING
                                          """File locations affected by the tool call."""
                                      
                                          raw_input: Any | MISSING = MISSING
                                          """Raw input parameters of the tool."""
                                      
                                          raw_output: Any | MISSING = MISSING
                                          """Raw output of the tool."""
                                      
                                          capabilities: ToolCallCapabilities | MISSING | None = MISSING
                                          """Controls the tool call currently supports, such as cancellation."""
                                      

                                      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

                                      name: str | MISSING | None = MISSING
                                      

                                      Programmatic name of the tool.

                                      raw_input class-attribute instance-attribute

                                      raw_input: Any | MISSING = MISSING
                                      

                                      Raw input parameters of the tool.

                                      raw_output class-attribute instance-attribute

                                      raw_output: Any | MISSING = MISSING
                                      

                                      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

                                      title: str | MISSING | None = MISSING
                                      

                                      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.

                                      Source code in src/aclientp/schema/v2/tool_calls.py
                                      class UnknownDiffChange(Unknown, _DiffChangeBase):
                                          """A custom or future file operation; values starting with ``_`` are extensions."""
                                      
                                          operation: str
                                          """The operation."""
                                      

                                      operation instance-attribute

                                      operation: str
                                      

                                      The operation.

                                      UnknownToolCallContent

                                      Bases: Unknown

                                      Custom or future tool call content; type values starting with _ are extensions.

                                      Source code in src/aclientp/schema/v2/tool_calls.py
                                      class UnknownToolCallContent(Unknown):
                                          """Custom or future tool call content; ``type`` values starting with ``_`` are extensions."""
                                      
                                          type: str
                                          """The content kind."""
                                      

                                      type instance-attribute

                                      type: str
                                      

                                      The content kind.