Skip to main content
Glama

renderChart

Generate static SVG charts from data using Semiotic visualization components like LineChart, BarChart, and Heatmap for data analysis and presentation.

Instructions

Render a Semiotic chart to static SVG. Returns SVG string or validation errors. Available components: AreaChart, BarChart, BoxPlot, BubbleChart, ChordDiagram, ChoroplethMap, CirclePack, ConnectedScatterplot, DistanceCartogram, DonutChart, DotPlot, FlowMap, ForceDirectedGraph, GroupedBarChart, Heatmap, LineChart, OrbitDiagram, PieChart, ProportionalSymbolMap, SankeyDiagram, Scatterplot, StackedAreaChart, StackedBarChart, SwarmPlot, TreeDiagram, Treemap.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentYesChart component name, e.g. 'LineChart', 'BarChart'
propsNoChart props object, e.g. { data: [...], xAccessor: 'x' }.

Implementation Reference

  • The handler function 'renderChartHandler' which processes the 'renderChart' MCP tool call. It validates the requested component, checks the component registry, and calls 'renderHOCToSVG' to produce the final SVG output.
    async function renderChartHandler(args: { component?: string; props?: Record<string, any> }): Promise<ToolResult> {
      const component = args.component
      const props: Record<string, any> = args.props ?? {}
    
      if (!component) {
        return {
          content: [{ type: "text" as const, text: `Missing 'component' field. Provide { component: '<name>', props: { ... } }. Available: ${componentNames.join(", ")}` }],
          isError: true,
        }
      }
    
      if (!COMPONENT_REGISTRY[component]) {
        return {
          content: [{ type: "text" as const, text: `Unknown component "${component}". Available: ${componentNames.join(", ")}` }],
          isError: true,
        }
      }
    
      const result = renderHOCToSVG(component, props)
      if (result.error) {
        return {
          content: [{ type: "text" as const, text: result.error }],
          isError: true,
        }
      }
      return {
        content: [{ type: "text" as const, text: result.svg! }],
      }
    }
  • Registration of the 'renderChart' MCP tool using the server instance, defining its schema (component name and props) and mapping it to 'renderChartHandler'.
    srv.tool(
      "renderChart",
      `Render a Semiotic chart to static SVG. Returns SVG string or validation errors. Available components: ${componentNames.join(", ")}.`,
      {
        component: z.string().describe("Chart component name, e.g. 'LineChart', 'BarChart'"),
        props: z.record(z.string(), z.unknown()).optional().describe("Chart props object, e.g. { data: [...], xAccessor: 'x' }."),
      },
      renderChartHandler
    )
Behavior2/5

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

No annotations are provided, so the description carries full burden. It discloses that the tool returns 'SVG string or validation errors' and lists available components, which adds some behavioral context. However, it lacks critical details: whether this is a read-only operation, if it has side effects, performance characteristics, authentication needs, or rate limits. For a tool with no annotations, this is insufficient.

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 sized with two sentences: one stating the purpose and return values, another listing components. It's front-loaded with the core functionality. However, the component list is lengthy and could be summarized more efficiently (e.g., 'Available components include LineChart, BarChart, and 20+ others').

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 no annotations, no output schema, and a tool with 2 parameters (including a complex nested object 'props'), the description is incomplete. It doesn't explain the structure of 'props', provide example inputs, describe error handling, or detail the SVG output format. For a visualization tool with nested parameters, this leaves significant gaps for an AI agent.

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?

Schema description coverage is 100%, so the baseline is 3. The description adds minimal value beyond the schema: it lists specific component examples (e.g., 'AreaChart', 'BarChart') which slightly clarifies the 'component' parameter, but doesn't explain 'props' object structure or provide usage examples. It doesn't compensate for any gaps since coverage is already high.

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: 'Render a Semiotic chart to static SVG' with specific verb ('Render') and resource ('Semiotic chart'). It distinguishes from siblings by specifying chart rendering rather than configuration diagnosis, schema retrieval, issue reporting, or chart suggestion. However, it doesn't explicitly differentiate from 'suggestChart' which might be related.

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

Usage Guidelines3/5

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

The description implies usage context by listing available components, suggesting this tool is for chart visualization. However, it provides no explicit guidance on when to use this tool versus alternatives like 'suggestChart' or other siblings. No prerequisites, exclusions, or comparative context are mentioned.

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

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/nteract/semiotic'

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