{
  "id": "chart.create",
  "object": "tool",
  "name": "Create chart",
  "summary": "Bar, line, area, pie, scatter.",
  "description": "Draws a clean chart from data: bar (vertical or horizontal, grouped or stacked), line, area (optionally stacked), pie, donut or scatter. Give rows with x and y field names, or labels plus a few series. Adds a title, axis labels, a legend for two or more series and optional value labels, in a light or dark theme with a colour-blind-safe palette. Always returns an SVG (hovering a mark shows its value); PNG needs Browser Rendering on the deployment.",
  "category": "data",
  "hosted_by": "Opentools",
  "runtime": "worker",
  "side_effects": false,
  "status": "live",
  "credits": 1,
  "price": "$0.0010",
  "providers": [
    {
      "id": "opentools",
      "name": "Opentools",
      "price": "$0.0010"
    }
  ],
  "mcp_name": "chart_create",
  "input_schema": {
    "type": "object",
    "properties": {
      "type": {
        "type": "string",
        "enum": [
          "bar",
          "line",
          "area",
          "pie",
          "donut",
          "scatter"
        ],
        "description": "Chart type"
      },
      "orientation": {
        "default": "vertical",
        "description": "Bar charts: columns or horizontal bars",
        "type": "string",
        "enum": [
          "vertical",
          "horizontal"
        ]
      },
      "stacked": {
        "default": false,
        "description": "Bar and area charts: stack series instead of grouping them",
        "type": "boolean"
      },
      "rows": {
        "description": "Data rows like [{ \"month\": \"Jan\", \"revenue\": 1200 }]. Give this with x and y, or give series.",
        "maxItems": 10000,
        "type": "array",
        "items": {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {}
        }
      },
      "x": {
        "description": "With rows: the field for labels (or x values for scatter)",
        "type": "string",
        "maxLength": 200
      },
      "y": {
        "description": "With rows: the value field, or several fields for several series",
        "anyOf": [
          {
            "type": "string",
            "maxLength": 200
          },
          {
            "minItems": 1,
            "maxItems": 8,
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 200
            }
          }
        ]
      },
      "labels": {
        "description": "With series: category labels along the axis. 1, 2, 3… if omitted.",
        "maxItems": 500,
        "type": "array",
        "items": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 200
            },
            {
              "type": "number"
            }
          ]
        }
      },
      "series": {
        "description": "Series, instead of rows",
        "minItems": 1,
        "maxItems": 8,
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "description": "Series name for the legend"
            },
            "values": {
              "description": "One value per label; null for a gap",
              "maxItems": 500,
              "type": "array",
              "items": {
                "type": [
                  "number",
                  "null"
                ]
              }
            },
            "points": {
              "description": "Scatter: points as { x, y }",
              "maxItems": 10000,
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "x": {
                    "type": "number"
                  },
                  "y": {
                    "type": "number"
                  },
                  "label": {
                    "type": "string",
                    "maxLength": 200
                  }
                },
                "required": [
                  "x",
                  "y"
                ]
              }
            }
          },
          "required": [
            "name"
          ]
        }
      },
      "title": {
        "description": "Chart title",
        "type": "string",
        "maxLength": 200
      },
      "subtitle": {
        "description": "A line under the title",
        "type": "string",
        "maxLength": 300
      },
      "x_label": {
        "description": "Label for the horizontal axis",
        "type": "string",
        "maxLength": 200
      },
      "y_label": {
        "description": "Label for the vertical axis",
        "type": "string",
        "maxLength": 200
      },
      "legend": {
        "default": "auto",
        "description": "auto shows a legend for two or more series, and always for pie and donut",
        "type": "string",
        "enum": [
          "auto",
          "show",
          "hide"
        ]
      },
      "value_labels": {
        "default": false,
        "description": "Print values: bar tips, stack totals, line ends, pie percentages",
        "type": "boolean"
      },
      "width": {
        "default": 800,
        "description": "Width in pixels",
        "type": "integer",
        "minimum": 240,
        "maximum": 4000
      },
      "height": {
        "default": 480,
        "description": "Height in pixels",
        "type": "integer",
        "minimum": 160,
        "maximum": 4000
      },
      "theme": {
        "default": "light",
        "description": "Colour theme",
        "type": "string",
        "enum": [
          "light",
          "dark"
        ]
      },
      "format": {
        "default": "svg",
        "description": "png also returns the SVG",
        "type": "string",
        "enum": [
          "svg",
          "png"
        ]
      },
      "scale": {
        "default": 2,
        "description": "PNG pixel density (2 = retina)",
        "type": "number",
        "minimum": 1,
        "maximum": 4
      },
      "name": {
        "description": "Output file name without extension",
        "type": "string",
        "maxLength": 120
      }
    },
    "required": [
      "type"
    ]
  },
  "kind": "tool"
}