ToolResult
The result of a tool execution. Contains a list of content parts, enabling rich tool results (text, images, files, audio) rather than just strings.
Implementations MUST support conversion from a plain string to a ToolResult containing a single TextPart for backward compatibility.
Class Diagram
Section titled “Class Diagram”---
title: ToolResult
config:
look: handDrawn
theme: colorful
class:
hideEmptyMembersBox: true
---
classDiagram
class ToolResult {
+ContentPart[] parts
+string status
+string errorKind
+string errorMessage
+float64 durationMs
}
class ContentPart {
<<abstract>>
+string kind
}
ToolResult *-- ContentPart
Yaml Example
Section titled “Yaml Example”parts: - kind: text value: 72°F and sunnyerrorKind: missing_toolerrorMessage: Tool 'get_weather' is not registereddurationMs: 42Properties
Section titled “Properties”| Name | Type | Description |
|---|---|---|
| parts | ContentPart[] | The content parts of the tool result(Related Types: TextPart, ImagePart, FilePart, AudioPart) |
| status | string | Semantic execution status for the tool result |
| errorKind | string | Stable machine-readable error category when status is not success |
| errorMessage | string | Human-readable error message when status is not success |
| durationMs | float64 | Tool execution duration in milliseconds |
Factory Methods
Section titled “Factory Methods”The following factory methods are declared via @factory and are generated automatically by the emitter in every language.
text(value: string)
Composed Types
Section titled “Composed Types”The following types are composed within ToolResult: