Skip to content

fix: simplify donut chart schema for OpenAI compatibility#8303

Open
mvanhorn wants to merge 1 commit intoaaif-goose:mainfrom
mvanhorn:fix/8173-autovisualiser-donut-schema
Open

fix: simplify donut chart schema for OpenAI compatibility#8303
mvanhorn wants to merge 1 commit intoaaif-goose:mainfrom
mvanhorn:fix/8173-autovisualiser-donut-schema

Conversation

@mvanhorn
Copy link
Copy Markdown

@mvanhorn mvanhorn commented Apr 4, 2026

Summary

Replaces the DonutChartData untagged enum with Vec<SingleDonutChart> in the autovisualiser's render_donut tool. The #[serde(untagged)] enum generated oneOf/anyOf in JSON Schema, which OpenAI's function calling schema validator rejects with Invalid schema for function 'autovisualiser__render_donut'.

Changes

In crates/goose-mcp/src/autovisualiser/mod.rs:

  • Removed DonutChartData enum (the #[serde(untagged)] source of the schema issue)
  • Changed RenderDonutParams.data from DonutChartData to Vec<SingleDonutChart>
  • Extracted validation to validate_donut_charts(&[SingleDonutChart])
  • Updated tool description and examples to show array-only input
  • Fixed text_fallback to handle single vs multiple charts from the array length

Testing

All 38 autovisualiser tests pass, including updated donut tests:

  • test_render_donut - single chart as one-element array
  • donut_rejects_empty_values - validation still catches empty values
  • donut_rejects_mismatched_labels - label count mismatch still caught
  • donut_rejects_empty_multiple - empty array rejected
  • Format round-trip tests updated for array input

Picks up from #8182 which was reviewed favorably by @DOsinga then self-closed by the author.

Fixes #8173

This contribution was developed with AI assistance (Codex).

@michaelneale
Copy link
Copy Markdown
Collaborator

@mvanhorn seems reasonable - so always a list? Mind signing the DCO for a clean build?

Replace DonutChartData untagged enum with Vec<SingleDonutChart>.
The untagged enum generated oneOf/anyOf in JSON Schema, which
OpenAI's function calling validator rejects. Now data is always
an array, eliminating the schema ambiguity.

Picks up from aaif-goose#8182 which was reviewed favorably then self-closed.

Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
@mvanhorn mvanhorn force-pushed the fix/8173-autovisualiser-donut-schema branch from b31bc32 to af46196 Compare April 6, 2026 14:40
@mvanhorn
Copy link
Copy Markdown
Author

mvanhorn commented Apr 6, 2026

Yep, always a list. Signed the DCO in af46196.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

autovisualiser__render_donut schema rejected by OpenAI-compatible tool calling

2 participants