Skip to content

Commit 2e911ee

Browse files
tomivirkkiclaude
andauthored
fix: add missing descriptions to tool parameter schema properties (#9087)
## Summary - Add descriptions to all tool parameter schema properties in `ChartAITools` that were previously missing them, improving the quality of LLM tool-calling by providing clear semantics for each property 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 725d9fb commit 2e911ee

1 file changed

Lines changed: 57 additions & 57 deletions

File tree

  • vaadin-ai-components-flow-parent/vaadin-ai-components-flow/src/main/java/com/vaadin/flow/component/ai/chart

vaadin-ai-components-flow-parent/vaadin-ai-components-flow/src/main/java/com/vaadin/flow/component/ai/chart/ChartAITools.java

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -317,51 +317,51 @@ public String getParametersSchema() {
317317
"description": "REQUIRED: Chart type - ALWAYS specify this property",
318318
"enum": ["line", "spline", "area", "areaspline", "bar", "column", "pie", "scatter", "gauge", "arearange", "columnrange", "areasplinerange", "boxplot", "errorbar", "bubble", "funnel", "waterfall", "pyramid", "solidgauge", "heatmap", "treemap", "polygon", "candlestick", "flags", "timeline", "ohlc", "organization", "sankey", "xrange", "gantt", "bullet"]
319319
},
320-
"{c:BACKGROUND_COLOR}": { "type": "string", "description": "Background color (e.g., '#ffffff')" },
321-
"{c:BORDER_COLOR}": { "type": "string", "description": "Border color" },
322-
"{c:BORDER_WIDTH}": { "type": "number", "description": "Border width in pixels" },
323-
"{c:BORDER_RADIUS}": { "type": "number", "description": "Border radius in pixels" },
320+
"{c:BACKGROUND_COLOR}": { "type": "string", "description": "Background color or gradient for the outer chart area (e.g., '#ffffff')" },
321+
"{c:BORDER_COLOR}": { "type": "string", "description": "Color of the outer chart border" },
322+
"{c:BORDER_WIDTH}": { "type": "number", "description": "Pixel width of the outer chart border" },
323+
"{c:BORDER_RADIUS}": { "type": "number", "description": "Corner radius of the outer chart border" },
324324
"{c:WIDTH}": { "type": "number", "description": "Chart width in pixels" },
325325
"{c:HEIGHT}": { "oneOf": [{ "type": "number", "description": "Height in pixels" }, { "type": "string", "description": "Height as string (e.g., '400px', '100%')" }] },
326-
"{c:MARGIN_TOP}": { "type": "number" },
327-
"{c:MARGIN_RIGHT}": { "type": "number" },
328-
"{c:MARGIN_BOTTOM}": { "type": "number" },
329-
"{c:MARGIN_LEFT}": { "type": "number" },
330-
"{c:SPACING_TOP}": { "type": "number" },
331-
"{c:SPACING_RIGHT}": { "type": "number" },
332-
"{c:SPACING_BOTTOM}": { "type": "number" },
333-
"{c:SPACING_LEFT}": { "type": "number" },
334-
"{c:PLOT_BACKGROUND_COLOR}": { "type": "string" },
335-
"{c:PLOT_BORDER_COLOR}": { "type": "string" },
336-
"{c:PLOT_BORDER_WIDTH}": { "type": "number" },
337-
"{c:INVERTED}": { "type": "boolean", "description": "Invert axes" },
338-
"{c:POLAR}": { "type": "boolean", "description": "Polar chart" },
339-
"{c:ANIMATION}": { "type": "boolean" },
340-
"{c:STYLED_MODE}": { "type": "boolean" },
341-
"{c:ZOOM_TYPE}": { "type": "string", "enum": ["x", "y", "xy"] }
326+
"{c:MARGIN_TOP}": { "type": "number", "description": "Fixed pixel margin between the top outer edge of the chart and the plot area" },
327+
"{c:MARGIN_RIGHT}": { "type": "number", "description": "Fixed pixel margin between the right outer edge of the chart and the plot area" },
328+
"{c:MARGIN_BOTTOM}": { "type": "number", "description": "Fixed pixel margin between the bottom outer edge of the chart and the plot area" },
329+
"{c:MARGIN_LEFT}": { "type": "number", "description": "Fixed pixel margin between the left outer edge of the chart and the plot area" },
330+
"{c:SPACING_TOP}": { "type": "number", "description": "Space between the top edge of the chart and the content" },
331+
"{c:SPACING_RIGHT}": { "type": "number", "description": "Space between the right edge of the chart and the content" },
332+
"{c:SPACING_BOTTOM}": { "type": "number", "description": "Space between the bottom edge of the chart and the content" },
333+
"{c:SPACING_LEFT}": { "type": "number", "description": "Space between the left edge of the chart and the content" },
334+
"{c:PLOT_BACKGROUND_COLOR}": { "type": "string", "description": "Background color or gradient for the plot area" },
335+
"{c:PLOT_BORDER_COLOR}": { "type": "string", "description": "Color of the inner chart or plot area border" },
336+
"{c:PLOT_BORDER_WIDTH}": { "type": "number", "description": "Pixel width of the plot area border" },
337+
"{c:INVERTED}": { "type": "boolean", "description": "Whether to invert the axes so that the x axis is vertical and y axis is horizontal" },
338+
"{c:POLAR}": { "type": "boolean", "description": "When true, cartesian charts are transformed into the polar coordinate system" },
339+
"{c:ANIMATION}": { "type": "boolean", "description": "Overall animation for all chart updating. Does not affect initial series animation." },
340+
"{c:STYLED_MODE}": { "type": "boolean", "description": "Whether to apply styled mode. When enabled, no presentational attributes or CSS are applied to the chart SVG." },
341+
"{c:ZOOM_TYPE}": { "type": "string", "description": "Decides in what dimensions the user can zoom by dragging the mouse", "enum": ["x", "y", "xy"] }
342342
}
343343
},
344344
"{c:TITLE}": {
345345
"oneOf": [
346346
{ "type": "string", "description": "Title text" },
347-
{ "type": "object", "properties": { "{c:TEXT}": { "type": "string" } } }
347+
{ "type": "object", "properties": { "{c:TEXT}": { "type": "string", "description": "The title text" } } }
348348
]
349349
},
350350
"{c:SUBTITLE}": {
351351
"oneOf": [
352352
{ "type": "string", "description": "Subtitle text" },
353-
{ "type": "object", "properties": { "{c:TEXT}": { "type": "string" } } }
353+
{ "type": "object", "properties": { "{c:TEXT}": { "type": "string", "description": "The subtitle text" } } }
354354
]
355355
},
356356
"{c:X_AXIS}": {
357357
"type": "object",
358358
"description": "X-axis configuration",
359359
"properties": {
360360
"{c:TYPE}": { "type": "string", "description": "Axis type", "enum": ["linear", "logarithmic", "datetime", "category"] },
361-
"{c:TITLE}": { "type": "object", "properties": { "{c:TEXT}": { "type": "string" } } },
362-
"{c:CATEGORIES}": { "type": "array", "items": { "type": "string" } },
363-
"{c:MIN}": { "type": "number" },
364-
"{c:MAX}": { "type": "number" }
361+
"{c:TITLE}": { "type": "object", "properties": { "{c:TEXT}": { "type": "string", "description": "The axis title text" } } },
362+
"{c:CATEGORIES}": { "type": "array", "items": { "type": "string" }, "description": "Category names to use instead of numbers for the axis" },
363+
"{c:MIN}": { "type": "number", "description": "Minimum value of the axis. Auto-calculated if null." },
364+
"{c:MAX}": { "type": "number", "description": "Maximum value of the axis. Auto-calculated if null." }
365365
}
366366
},
367367
"{c:Y_AXIS}": {
@@ -370,10 +370,10 @@ public String getParametersSchema() {
370370
"type": "object",
371371
"description": "Single Y-axis configuration",
372372
"properties": {
373-
"{c:TYPE}": { "type": "string", "enum": ["linear", "logarithmic", "datetime", "category"] },
374-
"{c:TITLE}": { "type": "object", "properties": { "{c:TEXT}": { "type": "string" } } },
375-
"{c:MIN}": { "type": "number" },
376-
"{c:MAX}": { "type": "number" }
373+
"{c:TYPE}": { "type": "string", "description": "Axis type", "enum": ["linear", "logarithmic", "datetime", "category"] },
374+
"{c:TITLE}": { "type": "object", "properties": { "{c:TEXT}": { "type": "string", "description": "The axis title text" } } },
375+
"{c:MIN}": { "type": "number", "description": "Minimum value of the axis. Auto-calculated if null." },
376+
"{c:MAX}": { "type": "number", "description": "Maximum value of the axis. Auto-calculated if null." }
377377
}
378378
},
379379
{
@@ -382,72 +382,72 @@ public String getParametersSchema() {
382382
"items": {
383383
"type": "object",
384384
"properties": {
385-
"{c:TYPE}": { "type": "string", "enum": ["linear", "logarithmic", "datetime", "category"] },
386-
"{c:TITLE}": { "type": "object", "properties": { "{c:TEXT}": { "type": "string" } } },
387-
"{c:MIN}": { "type": "number" },
388-
"{c:MAX}": { "type": "number" },
389-
"{c:OPPOSITE}": { "type": "boolean", "description": "Show axis on opposite side (right)" }
385+
"{c:TYPE}": { "type": "string", "description": "Axis type", "enum": ["linear", "logarithmic", "datetime", "category"] },
386+
"{c:TITLE}": { "type": "object", "properties": { "{c:TEXT}": { "type": "string", "description": "The axis title text" } } },
387+
"{c:MIN}": { "type": "number", "description": "Minimum value of the axis. Auto-calculated if null." },
388+
"{c:MAX}": { "type": "number", "description": "Maximum value of the axis. Auto-calculated if null." },
389+
"{c:OPPOSITE}": { "type": "boolean", "description": "Whether to display the axis on the opposite side of the normal (right for vertical axes, top for horizontal)" }
390390
}
391391
}
392392
}
393393
]
394394
},
395395
"{c:Z_AXIS}": {
396396
"type": "object",
397-
"description": "Z-axis configuration (for 3D and bubble charts)",
397+
"description": "Z-axis configuration (for 3D charts)",
398398
"properties": {
399399
"{c:TYPE}": { "type": "string", "description": "Axis type", "enum": ["linear", "logarithmic", "datetime", "category"] },
400-
"{c:TITLE}": { "type": "object", "properties": { "{c:TEXT}": { "type": "string" } } },
401-
"{c:MIN}": { "type": "number" },
402-
"{c:MAX}": { "type": "number" }
400+
"{c:TITLE}": { "type": "object", "properties": { "{c:TEXT}": { "type": "string", "description": "The axis title text" } } },
401+
"{c:MIN}": { "type": "number", "description": "Minimum value of the axis. Auto-calculated if null." },
402+
"{c:MAX}": { "type": "number", "description": "Maximum value of the axis. Auto-calculated if null." }
403403
}
404404
},
405405
"{c:COLOR_AXIS}": {
406406
"type": "object",
407407
"description": "Color axis for heatmaps",
408408
"properties": {
409-
"{c:MIN}": { "type": "number" },
410-
"{c:MAX}": { "type": "number" },
411-
"{c:MIN_COLOR}": { "type": "string" },
412-
"{c:MAX_COLOR}": { "type": "string" }
409+
"{c:MIN}": { "type": "number", "description": "Minimum value of the color axis" },
410+
"{c:MAX}": { "type": "number", "description": "Maximum value of the color axis" },
411+
"{c:MIN_COLOR}": { "type": "string", "description": "Color to represent the minimum value" },
412+
"{c:MAX_COLOR}": { "type": "string", "description": "Color to represent the maximum value" }
413413
}
414414
},
415415
"{c:TOOLTIP}": {
416416
"type": "object",
417417
"description": "Tooltip configuration",
418418
"properties": {
419-
"{c:POINT_FORMAT}": { "type": "string" },
420-
"{c:HEADER_FORMAT}": { "type": "string" },
421-
"{c:SHARED}": { "type": "boolean" },
422-
"{c:VALUE_SUFFIX}": { "type": "string" },
423-
"{c:VALUE_PREFIX}": { "type": "string" }
419+
"{c:POINT_FORMAT}": { "type": "string", "description": "HTML for the point's line in the tooltip. Variables like {point.y}, {series.name} are enclosed in curly brackets." },
420+
"{c:HEADER_FORMAT}": { "type": "string", "description": "HTML of the tooltip header line. Variables like {point.key}, {series.name} are enclosed in curly brackets." },
421+
"{c:SHARED}": { "type": "boolean", "description": "When true, the entire plot area captures mouse movement and tooltip texts for all series are shown in a single bubble" },
422+
"{c:VALUE_SUFFIX}": { "type": "string", "description": "A string to append to each series' y value in the tooltip" },
423+
"{c:VALUE_PREFIX}": { "type": "string", "description": "A string to prepend to each series' y value in the tooltip" }
424424
}
425425
},
426426
"{c:LEGEND}": {
427427
"type": "object",
428428
"description": "Legend configuration",
429429
"properties": {
430-
"{c:ENABLED}": { "type": "boolean" },
431-
"{c:ALIGN}": { "type": "string", "enum": ["left", "center", "right"] },
432-
"{c:VERTICAL_ALIGN}": { "type": "string", "enum": ["top", "middle", "bottom"] },
433-
"{c:LAYOUT}": { "type": "string", "enum": ["horizontal", "vertical"] }
430+
"{c:ENABLED}": { "type": "boolean", "description": "Enable or disable the legend" },
431+
"{c:ALIGN}": { "type": "string", "description": "Horizontal alignment of the legend box within the chart area", "enum": ["left", "center", "right"] },
432+
"{c:VERTICAL_ALIGN}": { "type": "string", "description": "Vertical alignment of the legend box", "enum": ["top", "middle", "bottom"] },
433+
"{c:LAYOUT}": { "type": "string", "description": "The layout of the legend items", "enum": ["horizontal", "vertical"] }
434434
}
435435
},
436436
"{c:CREDITS}": {
437437
"type": "object",
438438
"description": "Credits configuration",
439439
"properties": {
440-
"{c:ENABLED}": { "type": "boolean" },
441-
"{c:TEXT}": { "type": "string" },
442-
"{c:HREF}": { "type": "string" }
440+
"{c:ENABLED}": { "type": "boolean", "description": "Whether to show the credits text" },
441+
"{c:TEXT}": { "type": "string", "description": "The text for the credits label" },
442+
"{c:HREF}": { "type": "string", "description": "The URL for the credits label" }
443443
}
444444
},
445445
"{c:PANE}": {
446446
"type": "object",
447447
"description": "Pane configuration (for gauges and polar charts)",
448448
"properties": {
449-
"{c:START_ANGLE}": { "type": "number" },
450-
"{c:END_ANGLE}": { "type": "number" },
449+
"{c:START_ANGLE}": { "type": "number", "description": "Start angle of the polar X axis or gauge axis in degrees where 0 is north" },
450+
"{c:END_ANGLE}": { "type": "number", "description": "End angle of the polar X axis or gauge value axis in degrees where 0 is north" },
451451
"{c:CENTER}": { "type": "array", "items": { "type": "string" }, "description": "Center position ['50%', '50%']" },
452452
"{c:SIZE}": { "type": "string", "description": "Size (e.g., '100%')" }
453453
}

0 commit comments

Comments
 (0)