ToolResult.fromJson constructor

ToolResult.fromJson(
  1. Map<String, Object?> json
)

Reads the protocol's result object.

Implementation

factory ToolResult.fromJson(Map<String, Object?> json) => ToolResult(
  content: <ToolContent>[
    for (final Object? item in json['content'] as List? ?? const [])
      if (_object(item) case final Map<String, Object?> c)
        ToolContent.fromJson(c),
  ],
  structuredContent: _object(json['structuredContent']),
  isError: json['isError'] == true,
);