Enum ToolCallResultType
Classifies the outcome of invoking a single model-callable tool.
Consumers MUST handle unknown values defensively to remain forward-compatible with newer SDK versions (e.g., by treating unknown values as Error or logging and continuing).
public enum ToolCallResultType
Fields
Success = 0
The tool executed successfully and returned a value intended for model consumption.
Recommended JSON shape: Any valid JSON value (object/array/primitive) containing the tool's result.
Error = 1
The tool failed to execute or produced an application-level failure.
Recommended JSON shape:
{"error":{"message":"...", "code":"optional-code", "type":"OptionalErrorType", "data":{...}}}
.Canceled = 2
The invocation was cancelled before or during execution.
Typical causes include user-initiated cancellation, policy veto via a
BeforeToolInvocation
handler, or cooperative cancellation via CancellationToken. Recommended JSON shape:{"canceled":{"reason":"...", "by":"user|policy|system"}}
.Timeout = 3
The runtime aborted the call because the tool did not complete within the allotted time budget.
Recommended JSON shape:
{"timeout":{"durationMs":12345}}
.
Remarks
- The runtime guarantees that a ToolCallResultType value is always present on ToolCallResult; the enum is never left unspecified.
- JSON payload guidance: The recommended JSON shape for each type is described on the corresponding enum member. Producers should prefer compact JSON; consumers should be liberal in what they accept.