tool_call_reporter
Class info¶
Classes¶
| Name | Children | Inherits |
|---|---|---|
| ToolCallReporter aclientp.tool_call_reporter Stateful reporter for tool call progress. |
🛈 DocStrings¶
Stateful tool call progress reporter for ACP.
ToolCallReporter
¶
Stateful reporter for tool call progress.
Maintains the current state of a tool call and sends updates when fields are modified. This avoids having to repeat unchanged fields on every progress update.
Example
Source code in src/aclientp/tool_call_reporter.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
__aenter__
async
¶
__aexit__
async
¶
__aexit__(
exc_type: type[BaseException] | None,
exc_val: BaseException | None,
exc_tb: TracebackType | None,
) -> None
Exit async context, marking complete or failed based on exception.
Source code in src/aclientp/tool_call_reporter.py
__init__
¶
__init__(
notifications: ACPNotifications,
tool_call_id: str,
title: str,
*,
kind: ToolCallKind | None = None,
status: ToolCallStatus = "pending",
locations: Sequence[ToolCallLocation] | None = None,
content: Sequence[ToolCallContent] | None = None,
raw_input: Any | None = None,
raw_output: Any | None = None,
) -> None
Initialize the reporter with initial state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
notifications
|
ACPNotifications
|
The ACPNotifications instance to send updates through |
required |
tool_call_id
|
str
|
Unique identifier for this tool call |
required |
title
|
str
|
Human-readable title describing the tool action |
required |
kind
|
ToolCallKind | None
|
Category of tool being invoked |
None
|
status
|
ToolCallStatus
|
Initial execution status |
'pending'
|
locations
|
Sequence[ToolCallLocation] | None
|
File locations affected by this tool call |
None
|
content
|
Sequence[ToolCallContent] | None
|
Content produced by the tool call |
None
|
raw_input
|
Any | None
|
Raw input parameters sent to the tool |
None
|
raw_output
|
Any | None
|
Raw output returned by the tool |
None
|
Source code in src/aclientp/tool_call_reporter.py
complete
async
¶
Mark the tool call as completed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str | None
|
Optional final message to add |
None
|
raw_output
|
Any | None
|
Optional final output |
None
|
Source code in src/aclientp/tool_call_reporter.py
fail
async
¶
Mark the tool call as failed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
error
|
str | None
|
Optional error message to add |
None
|
raw_output
|
Any | None
|
Optional output (e.g., error details) |
None
|
Source code in src/aclientp/tool_call_reporter.py
start
async
¶
Send the initial tool_call notification.
This is called automatically if you use create_tool_reporter,
but can be called manually if constructing the reporter directly.
Source code in src/aclientp/tool_call_reporter.py
update
async
¶
update(
*,
title: str | None = None,
status: ToolCallStatus | None = None,
kind: ToolCallKind | None = None,
message: str | None = None,
raw_output: Any | None = None,
locations: Sequence[ToolCallLocation | str] | None = None,
content: Sequence[ToolCallContent | str] | None = None,
replace: bool = False,
) -> None
Update one or more fields and send the updated state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str | None
|
Update the human-readable title |
None
|
status
|
ToolCallStatus | None
|
Update the execution status |
None
|
kind
|
ToolCallKind | None
|
Update the tool kind |
None
|
message
|
str | None
|
Convenience for adding a text content block |
None
|
raw_output
|
Any | None
|
Update the raw output |
None
|
locations
|
Sequence[ToolCallLocation | str] | None
|
Locations to add or replace (path strings or ToolCallLocation) |
None
|
content
|
Sequence[ToolCallContent | str] | None
|
Content blocks to add or replace |
None
|
replace
|
bool
|
If True, replace all content/locations; if False, append |
False
|