Configuration for creating a tool

interface CreateToolConfig<T> {
    name: string;
    description: string;
    schema?: ZodType<T, unknown, $ZodTypeInternals<T, unknown>>;
    fn: ((args: T, context: ToolContext) => any);
    isLongRunning?: boolean;
    shouldRetryOnFailure?: boolean;
    maxRetryAttempts?: number;
}

Type Parameters

  • T extends Record<string, any> = Record<string, never>

Properties

name: string

The name of the tool

description: string

A description of what the tool does

schema?: ZodType<T, unknown, $ZodTypeInternals<T, unknown>>

Zod schema for validating tool arguments (optional)

fn: ((args: T, context: ToolContext) => any)

The function to execute (can be sync or async)

isLongRunning?: boolean

Whether the tool is a long running operation

shouldRetryOnFailure?: boolean

Whether the tool execution should be retried on failure

maxRetryAttempts?: number

Maximum retry attempts