Skip to main content
Glama

chart_generate

Create visual charts (bar, line, pie, doughnut, radar) from data to visualize information and insights clearly.

Instructions

Generate a chart image (bar, line, pie, etc.) ($0.002)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYes
labelsYes
datasetsYes
titleNo

Implementation Reference

  • index.js:50-79 (handler)
    The 'callTool' function serves as the centralized handler for all tool requests, including 'chart_generate', by making authenticated HTTP requests to the IteraTools API.
    async function callTool(endpoint, params) {
      const fetch = (await import('node-fetch')).default;
      const isGet = ['GET'].includes((TOOLS.find(t => t.endpoint === endpoint) || {}).method);
      
      const url = isGet 
        ? `${BASE_URL}${endpoint}?${new URLSearchParams(params)}`
        : `${BASE_URL}${endpoint}`;
      
      const res = await fetch(url, {
        method: isGet ? 'GET' : 'POST',
        headers: {
          'Content-Type': 'application/json',
          'Authorization': `Bearer ${API_KEY}`,
        },
        body: isGet ? undefined : JSON.stringify(params),
      });
      
      const text = await res.text();
      let data;
      try { data = JSON.parse(text); } catch { data = { raw: text }; }
      
      if (!res.ok) {
        if (res.status === 402) {
          throw new Error(`Insufficient credits. Add credits at https://iteratools.com. Cost: ${TOOLS.find(t=>t.endpoint===endpoint)?.price || 'see docs'}`);
        }
        throw new Error(`API error ${res.status}: ${text.substring(0, 200)}`);
      }
      
      return data;
    }
  • index.js:44-44 (registration)
    The 'chart_generate' tool is defined and registered within the 'TOOLS' array, specifying its name, schema, API endpoint, and pricing.
    { name: 'chart_generate', description: 'Generate a chart image (bar, line, pie, etc.)', inputSchema: { type: 'object', properties: { type: { type: 'string', enum: ['bar', 'line', 'pie', 'doughnut', 'radar'] }, labels: { type: 'array', items: { type: 'string' } }, datasets: { type: 'array', items: { type: 'object' } }, title: { type: 'string' } }, required: ['type', 'labels', 'datasets'] }, endpoint: '/chart/generate', price: '$0.002' },

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/fredpsantos33/itera-tools-mcp'

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