@Tool({...}) or as a function via tool().
Minimal tool (class)
Inline tool (function builder)
Tool metadata
annotationshint model & UI behavior (read-only, idempotent, etc.).hideFromDiscoverykeeps a tool callable but offtool/list.- Tools can attach per-tool hooks (see Advanced → Hooks).
Return values
- Return any serializable type; if you provide
outputSchema, it will validate. - Errors are surfaced via MCP error responses; you can also throw typed errors inside executors.

