get_public_dashboard
Retrieve a public dashboard by providing its share token. Access shared data without authentication.
Instructions
Get a public dashboard by its share token
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | Yes | Public share token of the dashboard |
Implementation Reference
- src/index.ts:756-769 (handler)MCP tool handler function for get_public_dashboard. Accepts validated params (token string), calls redashClient.getPublicDashboard(token), and returns the result as JSON text content or an error response.
async function getPublicDashboard(params: z.infer<typeof getPublicDashboardSchema>) { try { const result = await redashClient.getPublicDashboard(params.token); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { logger.error(`Error fetching public dashboard: ${error}`); return { isError: true, content: [{ type: "text", text: `Error fetching public dashboard: ${error instanceof Error ? error.message : String(error)}` }] }; } } - src/index.ts:752-754 (schema)Zod schema for get_public_dashboard input validation. Defines a single required parameter: token (string) for the public share token of the dashboard.
const getPublicDashboardSchema = z.object({ token: z.string() }); - src/index.ts:1874-1884 (registration)Tool registration in the ListToolsRequestSchema handler. Defines the tool name 'get_public_dashboard', description, and input JSON schema (type object with required string property 'token').
{ name: "get_public_dashboard", description: "Get a public dashboard by its share token", inputSchema: { type: "object", properties: { token: { type: "string", description: "Public share token of the dashboard" } }, required: ["token"] } }, - src/index.ts:2414-2416 (registration)Route registration in the CallToolRequestSchema switch statement. Maps the tool name 'get_public_dashboard' to its handler function with Zod schema validation.
case "get_public_dashboard": logger.debug(`Handling get_public_dashboard`); return await getPublicDashboard(getPublicDashboardSchema.parse(args)); - src/redashClient.ts:802-811 (helper)Redash API client method that performs the actual HTTP GET request to /api/dashboards/public/{token} and returns the dashboard data.
// Get public dashboard by token async getPublicDashboard(token: string): Promise<RedashDashboard> { try { const response = await this.client.get(`/api/dashboards/public/${token}`); return response.data; } catch (error) { logger.error(`Error fetching public dashboard: ${error}`); throw new Error(`Failed to fetch public dashboard: ${error instanceof Error ? error.message : String(error)}`); } }