Skip to main content
Glama

export-chart

Export charts from PI Dashboard in JSON or CSV formats by specifying the chart ID and desired format for data analysis or sharing.

Instructions

Export a chart in various formats

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesChart ID
formatYesExport format

Implementation Reference

  • Complete inline implementation of the 'export-chart' MCP tool handler. Registers the tool with Zod schema for inputs (chart ID and format: json/csv), makes authenticated API request to export endpoint, handles binary (base64 preview) or JSON/text responses, and returns formatted content or error.
    server.tool("export-chart", "Export a chart in various formats", {
        id: z.number().describe("Chart ID"),
        format: z.enum(["json", "csv"]).describe("Export format")
    }, async ({ id, format }) => {
        try {
            const result = await authenticatedRequest(`/charts/${id}/${format}`);
            if (result && typeof result === 'object' &&
                'contentType' in result && 'data' in result &&
                typeof result.data === 'string') {
                // This is a binary response
                return {
                    content: [{
                            type: "text",
                            text: `Chart exported successfully as ${format.toUpperCase()}.\nContent type: ${result.contentType}\nBase64 data: ${result.data.substring(0, 100)}...`
                        }]
                };
            }
            else {
                // This is a JSON or text response
                return {
                    content: [{
                            type: "text",
                            text: typeof result === 'string' ? result : JSON.stringify(result, null, 2)
                        }]
                };
            }
        }
        catch (error) {
            return {
                isError: true,
                content: [{ type: "text", text: `Error exporting chart: ${getErrorMessage(error)}` }]
            };
        }
    });
  • Input schema for the export-chart tool using Zod: requires numeric chart ID and format enum (json or csv).
    id: z.number().describe("Chart ID"),
    format: z.enum(["json", "csv"]).describe("Export format")
  • build/index.js:835-835 (registration)
    Registration of the 'export-chart' tool on the MCP server with name, description, schema, and handler.
    server.tool("export-chart", "Export a chart in various formats", {
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'export' but doesn't specify if this is a read-only operation, requires authentication, has side effects (e.g., file creation), or involves rate limits. The description is minimal and fails to cover key behavioral traits beyond the basic action.

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

Conciseness5/5

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

The description is extremely concise with a single sentence, 'Export a chart in various formats', which is front-loaded and wastes no words. It efficiently conveys the core purpose without unnecessary elaboration, earning full marks for brevity and clarity in structure.

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 of an export operation with no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., a file, data string), potential errors, or behavioral details. For a tool that likely involves data transformation and output, this leaves significant gaps in understanding.

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 clear documentation for 'id' (Chart ID) and 'format' (Export format with enum values). The description adds no additional meaning beyond what the schema provides, such as explaining what 'export' does with these parameters. Baseline 3 is appropriate since the schema does the heavy lifting.

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

Purpose3/5

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

The description 'Export a chart in various formats' clearly states the verb ('Export') and resource ('a chart'), but it's somewhat vague about what 'export' entails (e.g., generating a file, returning data). It distinguishes from siblings like 'delete-chart' or 'get-chart' by implying an output transformation, but lacks specificity on the export mechanism.

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?

No guidance is provided on when to use this tool versus alternatives. For example, it doesn't mention if this is for downloading charts versus retrieving them in different formats, or how it differs from 'get-chart' which might return chart data. The description offers no context on prerequisites or exclusions.

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/mingzilla/pi-api-mcp-server'

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