Skip to main content
Glama

get-category

Retrieve category details by ID using the PI API MCP Server, enabling efficient access to specific data within the PI Dashboard resources.

Instructions

Get a category by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesCategory ID

Implementation Reference

  • build/index.js:628-646 (registration)
    Registration of the 'get-category' MCP tool, including Zod input schema for category ID and inline async handler that makes an authenticated API request to fetch category details by ID, formats the response as text content, and handles errors appropriately.
    server.tool("get-category", "Get a category by ID", { id: z.number().describe("Category ID") }, async ({ id }) => { try { const category = await authenticatedRequest(`/categories/${id}`); return { content: [{ type: "text", text: `Category details:\n${JSON.stringify(category, null, 2)}` }] }; } catch (error) { return { isError: true, content: [{ type: "text", text: `Error fetching category: ${getErrorMessage(error)}` }] }; } });
  • The core handler function for the get-category tool. It takes a category ID, performs an authenticated GET request to /categories/{id}, returns the JSON-stringified category details in MCP text content format on success, or an error response on failure.
    }, async ({ id }) => { try { const category = await authenticatedRequest(`/categories/${id}`); return { content: [{ type: "text", text: `Category details:\n${JSON.stringify(category, null, 2)}` }] }; } catch (error) { return { isError: true, content: [{ type: "text", text: `Error fetching category: ${getErrorMessage(error)}` }] }; } });
  • Zod schema definition for the tool's input parameter: a required number representing the Category ID.
    id: z.number().describe("Category ID")

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