ChatTool.typed derives a provider JSON Schema from a Java record and converts a tool call back into that type. Nullable record components are optional in the generated schema.
record WeatherArguments(String city) { }
var weather = ChatTool.typed(WeatherArguments.class, arguments ->
CompletableFuture.completedFuture(
ToolExecutionResult.success(weatherFor(arguments.city()))));Runtime-aware tools receive ToolRuntime: your application context, a ToolStore, and a ToolProgressWriter. Configure the runtime once when building the agent. Return failures as tool-result content so the model can recover or explain them.