Interface FunctionTool<Parameters, UserData, Result>

interface FunctionTool<Parameters, UserData, Result> {
    [FUNCTION_TOOL_SYMBOL]: true;
    [TOOL_SYMBOL]: true;
    description: string;
    execute: ToolExecuteFunction<Parameters, UserData, Result>;
    flags: number;
    id: string;
    name: string;
    onDuplicate: DuplicateMode;
    parameters: ToolInputSchema<Parameters>;
    type: "function";
}

Type Parameters

  • Parameters extends JSONObject = JSONObject
  • UserData = UnknownUserData
  • Result = unknown

Hierarchy (view full)

Properties

[FUNCTION_TOOL_SYMBOL]: true
[TOOL_SYMBOL]: true
description: string

The description of the tool. Will be used by the language model to decide whether to use the tool.

execute: ToolExecuteFunction<Parameters, UserData, Result>

An async function that is called with the arguments from the tool call and produces a result. It also carries context about current session, user-defined data, and the tool call id, etc.

flags: number
id: string

Stable identifier used to key the tool inside a ToolContext. For function tools this mirrors name; for provider tools this is the provider tool id.

name: string

The name of the tool. Used to identify it inside a ToolContext and exposed to the LLM as the function name to call. Also surfaced as the inherited Tool.id.

onDuplicate: DuplicateMode
parameters: ToolInputSchema<Parameters>

The schema of the input that the tool expects. The language model will use this to generate the input. It is also used to validate the output of the language model. Use descriptions to make the input understandable for the language model.

type: "function"