Skip to main content
Glama

GetChartImgLink

Generate chart images by providing Quick Chart API parameters in JSON format. Create and retrieve chart visualization links for data representation.

Instructions

To draw chart and get chart image link by parameters, and parameter grammar follows Quick Chart API (quickchart.io).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jsonNoquick chart api's (quickchart.io) parameters and format is JSON object. The object does not include any functions, only values.

Implementation Reference

  • Core handler function implementing the logic to generate a QuickChart image link from the provided JSON chart configuration.
    export default async function getChartImgLink(
      agent: Client,
      json: any,
    ) {
      try {
    
        let jsonStr = '{}';
        try {
          jsonStr = JSON.stringify(json || '{}');
        } catch (e) {
          console.error(e);
        }
        if (jsonStr && (jsonStr?.includes('{') || jsonStr?.includes(',') || jsonStr?.includes('['))) {
          jsonStr = bestEffortForJson(jsonStr);
          jsonStr = encodeURIComponent(jsonStr); // check need to encodeURIComponent
        }
    
        const response = `${quickChartUrl}?c=${jsonStr || ''}`;
    
        return response;
    
      } catch (error: any) {
        throw new Error(`getChartImgLink failed: ${error.message}`);
      }
    }
  • Wrapper handler for the GetChartImgLink MCP tool that extracts input, calls the core getChartImgLink function, handles errors, and returns a standardized response.
    handler: async (agent: Client, input: Record<string, any>) => {
      try {
    
        const { json } = input || {};
    
        const response = await getChartImgLink(agent, json);
    
        return {
          status: "success",
          message: response,
        };
      } catch (error: any) {
        // Handle specific error types
        if (error.response) {
          const { status, data } = error.response;
          if (status === 429) {
            return {
              status: "error",
              message: "Rate limit exceeded. Please try again later.",
            };
          }
          return {
            status: "error",
            message: `error: ${data.error?.message || error.message}`,
          };
        }
    
        return {
          status: "error",
          message: `Failed to get information: ${error.message}`,
        };
      }
    },
  • Zod schema defining the input structure for the GetChartImgLink tool: a JSON object for QuickChart parameters.
    schema: z.object({
      json: z.any().describe("quick chart api's (quickchart.io) parameters and format is JSON object. The object does not include any functions, only values."),
    }),
  • Registers the GetChartImgLink ActionTool in the ACTIONS map, which is used by the MCP server to expose tools.
    const ACTIONS: any = {
      [EnumAction.GET_CHART_IMG_LINK]: getChartImgLink,
    }
  • Defines the string name 'GetChartImgLink' for the tool in EnumAction.
    'GET_CHART_IMG_LINK' = 'GetChartImgLink',
    'INSTALL_QUICK_CHART' = 'InstallQuickChart',
Behavior2/5

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

No annotations are provided, so the description must fully disclose behavioral traits. It mentions that parameters follow Quick Chart API, which hints at external behavior, but fails to describe critical aspects like whether this is a read/write operation, authentication needs, rate limits, error handling, or what the output (image link) entails. This leaves significant gaps in transparency for a tool that generates content.

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 concise and front-loaded in a single sentence, efficiently stating the tool's purpose and parameter reference. However, it could be slightly improved by structuring key details (e.g., separating usage notes) to enhance clarity without adding unnecessary length.

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 tool's complexity (generating chart images via an external API) and lack of annotations or output schema, the description is incomplete. It does not explain the return value (e.g., format of the image link), error conditions, or behavioral dependencies, leaving the agent with insufficient context to use the tool effectively.

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 input schema has 100% description coverage, with the parameter 'json' documented as using Quick Chart API format. The description adds marginal value by reiterating this and noting the JSON object excludes functions, but does not provide additional syntax, examples, or constraints beyond what the schema implies. This meets the baseline for high schema coverage.

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: 'draw chart and get chart image link by parameters'. It specifies the verb ('draw chart and get chart image link') and resource ('chart image link'), making the function understandable. However, with no sibling tools mentioned, it cannot demonstrate differentiation from alternatives, which prevents a perfect score.

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 minimal guidance on when to use this tool, only implying usage through the phrase 'by parameters' and referencing Quick Chart API. It lacks explicit instructions on when to use it versus alternatives, prerequisites, or exclusions, resulting in inadequate guidance for an agent.

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/datafe/quick-chart-mcp'

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