Basic tool
Async tools
Type inference
Type hints become JSON Schema automatically:list, dict, Literal, Enum, Optional, Pydantic models, dataclasses, unions, nested models.
Required parameters have no default. Optional parameters have one.
Decorator options
Structured returns
Return any JSON-serializable value:TextContent with JSON. Strings pass through. For explicit control:
Context access
Logging, progress, and cancellation viaget_context():
ctx.cancelled in loops. When true, clean up and return.