Skip to content

GeneratedToolResult

Namespace: Vercel.AI.Provider

public sealed class GeneratedToolResult : GeneratedContent

A tool result: one the provider produced itself, such as a web or file search, or one the generation loop produced by running a client tool.

Inheritance: object → GeneratedContent

View source

GeneratedToolResult(string, string, string, bool)

Section titled “GeneratedToolResult(string, string, string, bool)”
public GeneratedToolResult(string toolCallId, string toolName, string resultJson, bool isError = false)

Creates a provider-executed tool result.

Parameters

Name Type Description
toolCallId string
toolName string
resultJson string
isError bool

View source

public bool Dynamic { get; init; }

True when the tool is dynamic. Maps to the result’s dynamic.

Value: bool

View source

public Exception? Error { get; init; }

The exception the tool threw, when the generation loop ran a client tool that failed.

Value: Exception

View source

public bool IsError { get; }

Whether the tool failed.

Value: bool

View source

public JsonElement? ProviderMetadata { get; init; }

Provider-specific metadata for this result, keyed by provider name.

Value: JsonElement?

View source

public string ResultJson { get; }

JSON result.

Value: string

View source

public string ToolCallId { get; }

Matching tool call id.

Value: string

View source

public IReadOnlyDictionary<string, JsonElement>? ToolMetadata { get; init; }

Metadata of the tool, apart from provider metadata. Maps to the result’s toolMetadata.

Value: IReadOnlyDictionary<string, JsonElement>

View source

public string ToolName { get; }

Tool name.

Value: string

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product