Function tool

  • @tool decorator to mark a method as a tool with a description and schema. Supports both explicit ZodSchema and class-based schema derivation.

    Usage with ZodSchema: @tool("Description", z.object({ ... }))

    Usage with class-based schema: @tool("Description") async method(params: ClassBasedParams): Promise { ... }

    Parameters

    • description: string

      Description of the tool's functionality.

    • OptionalschemaOrClass: ZodType | SchemaConstructor

      Optional Zod schema or class constructor.

    Returns MethodDecorator

    A method decorator function.