LocalLm types documentation
    Preparing search index...

    Interface ToolSpec

    Represents a tool specification with an execute function.

    ToolSpec

    const toolSpec: ToolSpec = {
    name: "WeatherFetcher",
    description: "Fetches weather information.",
    arguments: {
    location: {
    description: "The location for which to fetch the weather.",
    required: true
    }
    },
    execute: async (args) => {
    const { location } = args || {};
    return `Weather in ${location}: Sunny, 72°F`;
    }
    };
    interface ToolSpec {
        arguments: {
            [key: string]: {
                description: string;
                required?: boolean;
                type?: string;
            };
        };
        canRun?: (tool: ToolSpec) => Promise<boolean>;
        description: string;
        execute: <O = any>(
            args: { [key: string]: string } | undefined,
        ) => Promise<O>;
        name: string;
    }

    Hierarchy (View Summary)

    Index

    Properties

    arguments: {
        [key: string]: {
            description: string;
            required?: boolean;
            type?: string;
        };
    }

    Arguments required by the tool, with descriptions for each argument.

    canRun?: (tool: ToolSpec) => Promise<boolean>
    description: string

    A description of what the tool does.

    execute: <O = any>(args: { [key: string]: string } | undefined) => Promise<O>

    The function to execute the tool with the provided arguments.

    name: string

    The name of the tool.