Skip to main content
Glama

get-chart

Retrieve specific charts by ID using the Model Context Protocol server, enabling secure access and management of PI Dashboard resources for AI assistants.

Instructions

Get a chart by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesChart ID

Implementation Reference

  • The main handler function for the 'get-chart' tool. It takes a chart ID, makes an authenticated API request to fetch the chart details, and returns the JSON-stringified chart data or an error message.
    }, async ({ id }) => { try { const chart = await authenticatedRequest(`/charts/${id}`); return { content: [{ type: "text", text: `Chart details:\n${JSON.stringify(chart, null, 2)}` }] }; } catch (error) { return { isError: true, content: [{ type: "text", text: `Error fetching chart: ${getErrorMessage(error)}` }] }; } });
  • Zod schema defining the input parameter 'id' as a number for the chart ID.
    id: z.number().describe("Chart ID")
  • build/index.js:795-813 (registration)
    The server.tool call that registers the 'get-chart' tool, including its description, input schema, and inline handler function.
    server.tool("get-chart", "Get a chart by ID", { id: z.number().describe("Chart ID") }, async ({ id }) => { try { const chart = await authenticatedRequest(`/charts/${id}`); return { content: [{ type: "text", text: `Chart details:\n${JSON.stringify(chart, null, 2)}` }] }; } catch (error) { return { isError: true, content: [{ type: "text", text: `Error fetching chart: ${getErrorMessage(error)}` }] }; } });

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