Skip to main content
Glama

list-charts

Retrieve and filter charts from PI Dashboard resources with pagination support, enabling precise data selection based on customizable criteria.

Instructions

List all charts with filtering support

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filterNoFilter criteria in the format 'fieldName(operator)=value'. Multiple filters can be combined with & (e.g., 'description(like)=revenue&categoryId(eq)=5'). Available operators: eq, ne, gt, lt, ge, le, like, nlike. Use get-filterable-attributes tool to see available fields.
pageNoPage number for pagination
pageSizeNoNumber of items per page

Implementation Reference

  • The handler function that implements the core logic of the 'list-charts' tool. It handles input parameters, parses filters using the parseFilters helper, constructs query parameters for pagination, performs an authenticated GET request to the /charts endpoint, and returns the results as formatted text or an error message.
    }, async ({ filter, page, pageSize }) => {
        try {
            let queryParams = {
                page: page.toString(),
                pageSize: pageSize.toString()
            };
            // Parse and add filter parameters
            if (filter) {
                const filterParams = parseFilters(filter);
                queryParams = { ...queryParams, ...filterParams };
            }
            const charts = await authenticatedRequest("/charts", "GET", null, queryParams);
            return {
                content: [{
                        type: "text",
                        text: `Charts retrieved successfully:\n${JSON.stringify(charts, null, 2)}`
                    }]
            };
        }
        catch (error) {
            return {
                isError: true,
                content: [{ type: "text", text: `Error fetching charts: ${getErrorMessage(error)}` }]
            };
        }
    });
  • Zod schema defining the input parameters for the 'list-charts' tool: optional filter string, page (default 1), and pageSize (default 20).
    filter: z.string().optional().describe("Filter criteria in the format 'fieldName(operator)=value'. Multiple filters can be combined with & (e.g., 'description(like)=revenue&categoryId(eq)=5'). Available operators: eq, ne, gt, lt, ge, le, like, nlike. Use get-filterable-attributes tool to see available fields."),
    page: z.number().optional().default(1).describe("Page number for pagination"),
    pageSize: z.number().optional().default(20).describe("Number of items per page")
  • build/index.js:764-793 (registration)
    The server.tool registration call for 'list-charts', including description, input schema, and inline handler function.
    server.tool("list-charts", "List all charts with filtering support", {
        filter: z.string().optional().describe("Filter criteria in the format 'fieldName(operator)=value'. Multiple filters can be combined with & (e.g., 'description(like)=revenue&categoryId(eq)=5'). Available operators: eq, ne, gt, lt, ge, le, like, nlike. Use get-filterable-attributes tool to see available fields."),
        page: z.number().optional().default(1).describe("Page number for pagination"),
        pageSize: z.number().optional().default(20).describe("Number of items per page")
    }, async ({ filter, page, pageSize }) => {
        try {
            let queryParams = {
                page: page.toString(),
                pageSize: pageSize.toString()
            };
            // Parse and add filter parameters
            if (filter) {
                const filterParams = parseFilters(filter);
                queryParams = { ...queryParams, ...filterParams };
            }
            const charts = await authenticatedRequest("/charts", "GET", null, queryParams);
            return {
                content: [{
                        type: "text",
                        text: `Charts retrieved successfully:\n${JSON.stringify(charts, null, 2)}`
                    }]
            };
        }
        catch (error) {
            return {
                isError: true,
                content: [{ type: "text", text: `Error fetching charts: ${getErrorMessage(error)}` }]
            };
        }
    });
  • Supporting utility function parseFilters that converts a filter string (e.g., 'description(like)=revenue&categoryId(eq)=5') into an object of query parameters used by the list-charts handler.
    function parseFilters(filterString) {
        const queryParams = {};
        if (!filterString)
            return queryParams;
        // Split by & to handle multiple filters
        const filters = filterString.split('&');
        for (const filter of filters) {
            // Match the pattern fieldName(operator)=value
            const match = filter.match(/([a-zA-Z]+)\(([a-zA-Z]+)\)=(.+)/);
            if (match) {
                const [_, field, operator, value] = match;
                queryParams[`${field}(${operator})`] = value;
            }
        }
        return queryParams;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. 'List all charts' implies a read operation, but there's no information about permissions required, rate limits, pagination behavior beyond what's in the schema, or what format the results will be in. The description doesn't address whether this is a safe operation or has any side effects.

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 a single, efficient sentence that communicates the core functionality without any wasted words. It's appropriately sized for a listing tool and front-loads the essential information. Every word earns its place in the description.

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?

For a tool with 3 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what 'charts' are in this context, what data is returned, or how results are structured. The mention of 'filtering support' is helpful but doesn't compensate for the lack of behavioral and output context needed for proper tool invocation.

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 schema already fully documents all three parameters. The description mentions 'filtering support' which aligns with the 'filter' parameter but doesn't add any semantic information beyond what's already in the schema descriptions. This meets the baseline expectation when schema coverage is complete.

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 verb 'List' and resource 'charts', making the purpose evident. It adds 'with filtering support' which provides additional context about capabilities. However, it doesn't explicitly differentiate from sibling tools like 'get-chart' or 'export-chart', which would require more specific scope definition.

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. There's no mention of when to choose 'list-charts' over 'get-chart' (for single chart retrieval) or 'export-chart' (for data export). No prerequisites, exclusions, or comparative context is provided.

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