toJson method

  1. @override
Map<String, dynamic> toJson()
override

Re-encode to the externally-tagged wire shape ({tag: payload}).

Implementation

@override
Map<String, dynamic> toJson() => {
      'ToolResult': {
        'tool_call_id': toolCallId,
        'tool_name': toolName,
        'result': result,
        if (isError != null) 'is_error': isError,
        if (preliminary != null) 'preliminary': preliminary,
        if (isDynamic != null) 'dynamic': isDynamic,
        if (providerMetadata != null) 'provider_metadata': providerMetadata,
      },
    };