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
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Chart ID |
Implementation Reference
- build/index.js:797-813 (handler)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)}` }] }; } });
- build/index.js:796-796 (schema)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)}` }] }; } });