toolOutputSchema property
SchemanticType<Output> ?
toolOutputSchema
final
The schema of Output, as passed to the constructor's outputSchema.
It is what the model, the Dev UI and MCP tools/list see as the tool's
output.
final weather = ai.defineTool(
name: 'weather',
description: 'Current weather',
outputSchema: Weather.$schema,
fn: (city, ctx) async => .response(await fetchWeather(city)),
);
weather.toolOutputSchema; // Weather.$schema
weather.outputSchema; // always null: see below
It can't be the inherited outputSchema: that getter is typed by the
action's output, which for a tool is the ToolResult wrapper (a response
or an interrupt), not Output.
Implementation
final SchemanticType<Output>? toolOutputSchema;