get_dashboard
Retrieve details of a specific dashboard by providing its ID.
Instructions
Get details of a specific dashboard
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dashboardId | Yes | ID of the dashboard to get |
Implementation Reference
- src/index.ts:375-405 (handler)Schema definition and handler function for the 'get_dashboard' tool. The schema requires a 'dashboardId' (coerced to number). The handler calls redashClient.getDashboard(dashboardId) and returns the dashboard data as JSON.
// Tool: get_dashboard const getDashboardSchema = z.object({ dashboardId: z.coerce.number() }); async function getDashboard(params: z.infer<typeof getDashboardSchema>) { try { const { dashboardId } = params; const dashboard = await redashClient.getDashboard(dashboardId); return { content: [ { type: "text", text: JSON.stringify(dashboard, null, 2) } ] }; } catch (error) { console.error(`Error getting dashboard ${params.dashboardId}:`, error); return { isError: true, content: [ { type: "text", text: `Error getting dashboard ${params.dashboardId}: ${error instanceof Error ? error.message : String(error)}` } ] }; } } - src/index.ts:1723-1733 (registration)Registration of the 'get_dashboard' tool in the ListToolsRequestSchema handler, including its name, description, and inputSchema (requiring dashboardId).
{ name: "get_dashboard", description: "Get details of a specific dashboard", inputSchema: { type: "object", properties: { dashboardId: { type: "number", description: "ID of the dashboard to get" } }, required: ["dashboardId"] } }, - src/index.ts:2368-2370 (registration)The CallToolRequestSchema switch case that routes 'get_dashboard' tool calls to the getDashboard handler with schema validation.
case "get_dashboard": logger.debug(`Handling get_dashboard`); return await getDashboard(getDashboardSchema.parse(args)); - src/redashClient.ts:602-610 (helper)The underlying redashClient.getDashboard() method that makes the actual HTTP GET request to /api/dashboards/{dashboardId} and returns a RedashDashboard.
async getDashboard(dashboardId: number): Promise<RedashDashboard> { try { const response = await this.client.get(`/api/dashboards/${dashboardId}`); return response.data; } catch (error) { console.error(`Error fetching dashboard ${dashboardId}:`, error); throw new Error(`Failed to fetch dashboard ${dashboardId} from Redash`); } } - src/redashClient.ts:86-112 (schema)The RedashDashboard interface defining the shape of the dashboard data returned by the get_dashboard tool.
export interface RedashDashboard { id: number; name: string; slug: string; tags: string[]; is_archived: boolean; is_draft: boolean; created_at: string; updated_at: string; version: number; dashboard_filters_enabled: boolean; widgets: Array<{ id: number; visualization?: { id: number; type: string; name: string; description: string; options: any; query_id: number; }; text?: string; width: number; options: any; dashboard_id: number; }>; }