Skip to content

ToolUIPart

Namespace: Vercel.AI.Ui

public sealed class ToolUIPart : UIMessagePart

A tool invocation part. Its type is tool-{name}, or dynamic-tool for a tool whose name is not known up front. Maps to ToolUIPart and DynamicToolUIPart.

Inheritance: object → UIMessagePart

View source

ToolUIPart(string, string, ToolUIPartState, bool)

Section titled “ToolUIPart(string, string, ToolUIPartState, bool)”
public ToolUIPart(string toolName, string toolCallId, ToolUIPartState state, bool isDynamic = false)

Creates a tool part for the tool <code class=“paramref”>toolName</code>.

Parameters

Name Type Description
toolName string
toolCallId string
state ToolUIPartState
isDynamic bool

View source

public ToolUIApproval? Approval { get; init; }

The approval of the call.

Value: ToolUIApproval

View source

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

The provider metadata of the call.

Value: IReadOnlyDictionary<string, JsonElement>

View source

public bool? Dynamic { get; init; }

For a dynamic-tool part, false when the part came from a static tool that is no longer available. Maps to dynamic: false.

Value: bool?

View source

public string? ErrorText { get; init; }

The error text of a failed call.

Value: string

View source

public JsonElement? Input { get; init; }

The tool input. Null when it is undefined.

Value: JsonElement?

View source

public bool IsDynamic { get; }

True for a dynamic-tool part.

Value: bool

View source

public JsonElement? Output { get; init; }

The tool output. Null when it is undefined.

Value: JsonElement?

View source

public bool? Preliminary { get; init; }

True when the output is a preliminary result.

Value: bool?

View source

public bool? ProviderExecuted { get; init; }

Whether the provider executed the tool.

Value: bool?

View source

public JsonElement? RawInput { get; init; }

The raw input of a failed or streaming call.

Value: JsonElement?

View source

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

The provider metadata of the result.

Value: IReadOnlyDictionary<string, JsonElement>

View source

public ToolUIPartState State { get; }

The state of the invocation.

Value: ToolUIPartState

View source

public string? Title { get; init; }

The title of the tool.

Value: string

View source

public string ToolCallId { get; }

The tool call id.

Value: string

View source

public string ToolName { get; }

The tool name.

Value: string

View source

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