Skip to content

ParsedToolCall

Namespace: Vercel.AI.GenerateText

public sealed class ParsedToolCall

A tool call after its input was parsed and validated. Maps to a TypedToolCall.

Inheritance: object

View source

ParsedToolCall(string, string, JsonElement)

Section titled “ParsedToolCall(string, string, JsonElement)”
public ParsedToolCall(string toolCallId, string toolName, JsonElement input)

Creates a parsed tool call.

Parameters

Name Type Description
toolCallId string
toolName string
input JsonElement

View source

public bool Dynamic { get; init; }

True when the tool is dynamic: a dynamic tool, a provider-executed dynamic call, or an invalid call. Maps to dynamic.

Value: bool

View source

public Exception? Error { get; init; }

Why the call is invalid, such as an InvalidToolInputError, a NoSuchToolError or a ToolCallRepairError.

Value: Exception

View source

public JsonElement Input { get; }

The parsed input. When Invalid is true this is the raw input, parsed when it is valid JSON and a JSON string otherwise.

Value: JsonElement

View source

public bool Invalid { get; init; }

True when the call failed: its tool is unknown, its input did not parse, or the input did not match the tool’s input schema. Such a call is dynamic.

Value: bool

View source

public bool ProviderExecuted { get; init; }

True when the provider executed the tool.

Value: bool

View source

public JsonElement? ProviderMetadata { get; init; }

Provider-specific metadata of the call, as the model returned it.

Value: JsonElement?

View source

public string? Title { get; init; }

Display title of the tool.

Value: string

View source

public string ToolCallId { get; }

Provider id for this call.

Value: string

View source

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

Metadata of the tool. It stays apart from ProviderMetadata. Maps to 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