@tool decorator to mark a method as a tool with a description and schema.
Supports explicit ZodSchema, class-based schema derivation, and primitive types.
Usage with ZodSchema:
@tool("Description", z.object({ ... }))
When using primitive types, the parameter is automatically wrapped in an object
with a 'value' property for the LLM, and unwrapped when calling your method.
@tooldecorator to mark a method as a tool with a description and schema. Supports explicit ZodSchema, class-based schema derivation, and primitive types.Usage with ZodSchema: @tool("Description", z.object({ ... }))
Usage with class-based schema: @tool("Description") async method(params: ClassBasedParams): Promise { ... }
Usage with primitive types (String, Number, Boolean): @tool("Description") async method(query: string): Promise { ... }
When using primitive types, the parameter is automatically wrapped in an object with a 'value' property for the LLM, and unwrapped when calling your method.