Skip to main content
Glama

generate_scatter_chart

Create scatter charts to visualize relationships between two variables, identify trends, and analyze data distribution patterns. Customize axis titles, dimensions, themes, and export options for PNG, SVG, or ECharts configurations.

Instructions

Generate a scatter chart to show the relationship between two variables, helps discover their relationship or trends, such as, the strength of correlation, data distribution patterns.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
axisXTitleNoSet the x-axis title of chart.
axisYTitleNoSet the y-axis title of chart.
dataYesData for scatter chart, such as, [{ x: 10, y: 15 }, { x: 20, y: 25 }].
heightNoSet the height of the chart, default is 600px.
outputTypeNoThe output type of the diagram. Can be 'png', 'svg' or 'option'. Default is 'png', 'png' will return the rendered PNG image, 'svg' will return the rendered SVG string, and 'option' will return the valid ECharts option.png
themeNoSet the theme for the chart, optional, default is 'default'.default
titleNoSet the title of the chart.
widthNoSet the width of the chart, default is 800px.

Implementation Reference

  • The 'run' function that implements the tool's core logic: processes input data into ECharts-compatible scatter series, sets up chart options including axes, title, and tooltip, then invokes the shared generateChartImage utility to render and return the chart image or option.
    run: async (params: {
      axisXTitle?: string;
      axisYTitle?: string;
      data: Array<{ x: number; y: number }>;
      height: number;
      theme?: "default" | "dark";
      title?: string;
      width: number;
      outputType?: "png" | "svg" | "option";
    }) => {
      const {
        axisXTitle,
        axisYTitle,
        data,
        height,
        theme,
        title,
        width,
        outputType,
      } = params;
    
      // Transform data for ECharts scatter chart
      const scatterData = data.map((item) => [item.x, item.y]);
    
      const series: Array<SeriesOption> = [
        {
          data: scatterData,
          type: "scatter",
          symbolSize: 8,
          emphasis: {
            focus: "series",
            itemStyle: {
              shadowBlur: 10,
              shadowOffsetX: 0,
              shadowColor: "rgba(0, 0, 0, 0.5)",
            },
          },
        },
      ];
    
      const echartsOption: EChartsOption = {
        series,
        title: {
          left: "center",
          text: title,
        },
        tooltip: {
          trigger: "item",
        },
        xAxis: {
          name: axisXTitle,
          type: "value",
          scale: true,
        },
        yAxis: {
          name: axisYTitle,
          type: "value",
          scale: true,
        },
      };
    
      return await generateChartImage(
        echartsOption,
        width,
        height,
        theme,
        outputType,
        "generate_scatter_chart",
      );
    },
  • Zod inputSchema defining the tool's parameters: axis titles, data points array (non-empty), chart dimensions, theme, title, and output type.
    inputSchema: z.object({
      axisXTitle: AxisXTitleSchema,
      axisYTitle: AxisYTitleSchema,
      data: z
        .array(data)
        .describe(
          "Data for scatter chart, such as, [{ x: 10, y: 15 }, { x: 20, y: 25 }].",
        )
        .nonempty({ message: "Scatter chart data cannot be empty." }),
      height: HeightSchema,
      theme: ThemeSchema,
      title: TitleSchema,
      width: WidthSchema,
      outputType: OutputTypeSchema,
    }),
  • Export of the 'tools' array that collects and registers generateScatterChartTool (line 25) along with other chart tools, imported from individual tool files.
    export const tools = [
      generateEChartsTool,
      generateLineChartTool,
      generateBarChartTool,
      generatePieChartTool,
      generateRadarChartTool,
      generateScatterChartTool,
      generateSankeyChartTool,
      generateFunnelChartTool,
      generateGaugeChartTool,
      generateTreemapChartTool,
      generateSunburstChartTool,
      generateHeatmapChartTool,
      generateCandlestickChartTool,
      generateBoxplotChartTool,
      generateGraphChartTool,
      generateParallelChartTool,
      generateTreeChartTool,
    ];
  • src/index.ts:22-35 (registration)
    The createEChartsServer function imports the 'tools' array and loops to register each tool (including generate_scatter_chart) with the MCP server using server.tool().
    function createEChartsServer(): McpServer {
      const server = new McpServer({
        name: "mcp-echarts",
        version: "0.1.0",
      });
    
      for (const tool of tools) {
        const { name, description, inputSchema, run } = tool;
        // biome-ignore lint/suspicious/noExplicitAny: <explanation>
        server.tool(name, description, inputSchema.shape, run as any);
      }
    
      return server;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. The description only states what the tool does functionally (generates a scatter chart) but doesn't mention any behavioral traits such as performance characteristics, error handling, whether it's idempotent, or what the output looks like (e.g., returns an image, SVG, or configuration). For a tool with 8 parameters and no output schema, this is inadequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately concise at one sentence that clearly states the tool's purpose. It's front-loaded with the main function and includes a brief explanation of why scatter charts are useful. There's no wasted verbiage, though it could potentially benefit from more structured guidance given the complex sibling tool context.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (8 parameters, no annotations, no output schema, and 15 sibling tools), the description is incomplete. It doesn't address key contextual information needed for proper tool selection and usage, such as output format expectations, performance considerations, or differentiation from other chart types. The description provides only basic functional information without the richer context needed for this tool category.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds no parameter-specific information beyond what's already in the schema. With 100% schema description coverage, all 8 parameters are well-documented in the input schema itself. The description doesn't provide additional context about parameter interactions, constraints, or usage patterns, so it meets the baseline of 3 where the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Generate a scatter chart to show the relationship between two variables.' It specifies the verb ('generate') and resource ('scatter chart'), and mentions the goal of discovering relationships or trends. However, it doesn't explicitly differentiate from sibling tools like 'generate_line_chart' or 'generate_bar_chart' in terms of when to use a scatter chart versus other chart types.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It mentions that scatter charts help discover relationships between variables, but doesn't specify scenarios where a scatter chart is preferred over other chart types (e.g., line charts for time series, bar charts for categorical comparisons). With 15 sibling chart tools, this lack of differentiation is a significant gap.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hustcc/mcp-echarts'

If you have feedback or need assistance with the MCP directory API, please join our Discord server