CreateMessageResult class

Create message result from sampling.

Spec 2025-11-25+ adds sampling tool calling: when the model responds by invoking tools (rather than emitting a final message), the result carries the requested calls in toolCalls and typically reports a tool-use stopReason. toolCalls is carried losslessly (each entry is the raw tool-call object as sent by the peer) so the caller can dispatch the calls and continue the sampling loop; it is absent for plain completions, keeping older-revision results unchanged (additive).

Annotations
  • @immutable

Constructors

CreateMessageResult({required String model, String? stopReason, required String role, required Content content, List<Map<String, dynamic>>? toolCalls})
const
CreateMessageResult.fromJson(Map<String, dynamic> json)
factory

Properties

content Content
final
hashCode int
The hash code for this object.
no setterinherited
hasToolCalls bool
Whether this sampling turn resolved to tool calls (spec 2025-11-25+).
no setter
model String
final
role String
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stopReason String?
final
toolCalls List<Map<String, dynamic>>?
Spec 2025-11-25+: tool calls the model requested, when the sampling turn resolved to tool use instead of a final message. Null when the model returned a normal completion.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited