Skip to main content
Glama

list-categories

Retrieve and filter dashboard categories from the PI API MCP Server with pagination support for organized data management.

Instructions

List all categories 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)=dashboard&orgId(eq)=1'). 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 for the 'list-categories' tool. It constructs query parameters for pagination and filters (using parseFilters helper), makes an authenticated GET request to the /categories API endpoint, and returns the response as text or error.
    }, 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 categories = await authenticatedRequest("/categories", "GET", null, queryParams);
            return {
                content: [{
                        type: "text",
                        text: `Categories retrieved successfully:\n${JSON.stringify(categories, null, 2)}`
                    }]
            };
        }
        catch (error) {
            return {
                isError: true,
                content: [{ type: "text", text: `Error fetching categories: ${getErrorMessage(error)}` }]
            };
        }
    });
  • Zod input schema defining optional filter string, page (default 1), and pageSize (default 20) parameters for the list-categories tool.
    filter: z.string().optional().describe("Filter criteria in the format 'fieldName(operator)=value'. Multiple filters can be combined with & (e.g., 'description(like)=dashboard&orgId(eq)=1'). 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:597-597 (registration)
    Registration of the 'list-categories' tool on the MCP server using server.tool method.
    server.tool("list-categories", "List all categories with filtering support", {
  • Helper function used by list-categories (and list-charts) to parse filter strings like 'description(like)=foo&orgId(eq)=1' into API query parameters.
    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 the full burden of behavioral disclosure. It mentions 'filtering support' and implies pagination through parameters, but doesn't describe what the tool returns (e.g., list structure, error handling), whether it's read-only, or any rate limits. For a list tool with 3 parameters, this leaves significant behavioral gaps.

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 gets straight to the point with zero wasted words. It's appropriately sized for a list tool and front-loads the core functionality.

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 has 3 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns (list format, fields included), error conditions, or how it differs from sibling tools. For a list tool with filtering and pagination, more context is needed for proper agent usage.

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 schema description coverage is 100%, so the schema already fully documents all 3 parameters (filter, page, pageSize). The description adds no additional parameter information beyond what's in the schema, so it meets the baseline of 3 where the schema does the heavy lifting.

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 the resource 'categories', making the purpose specific and understandable. It also mentions 'filtering support' which adds useful context about functionality. However, it doesn't explicitly differentiate from sibling tools like 'list-category-objects' or 'get-category', which would require a 5.

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 like 'get-category' (for single category retrieval) or 'list-category-objects' (for objects within categories). It mentions filtering support but doesn't explain when filtering is appropriate or when to use other tools for different needs.

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