Skip to content
Prompty

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.

---
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
parts:
- kind: text
value: 72°F and sunny
errorKind: missing_tool
errorMessage: Tool 'get_weather' is not registered
durationMs: 42
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

The following factory methods are declared via @factory and are generated automatically by the emitter in every language.

  • text(value: string)

The following types are composed within ToolResult: