list_dashboards
List all dashboards in Redash with pagination support using page and page size parameters.
Instructions
List all available dashboards in Redash
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number (starts at 1) | |
| pageSize | No | Number of results per page |
Implementation Reference
- src/index.ts:342-346 (schema)Input schema for the list_dashboards tool. Accepts optional 'page' (default 1) and 'pageSize' (default 25) parameters.
// Tool: list_dashboards const listDashboardsSchema = z.object({ page: z.coerce.number().optional().default(1), pageSize: z.coerce.number().optional().default(25) }); - src/index.ts:348-373 (handler)Handler function for the list_dashboards tool. Calls redashClient.getDashboards(page, pageSize) and returns the result as JSON.
async function listDashboards(params: z.infer<typeof listDashboardsSchema>) { try { const { page, pageSize } = params; const dashboards = await redashClient.getDashboards(page, pageSize); return { content: [ { type: "text", text: JSON.stringify(dashboards, null, 2) } ] }; } catch (error) { console.error('Error listing dashboards:', error); return { isError: true, content: [ { type: "text", text: `Error listing dashboards: ${error instanceof Error ? error.message : String(error)}` } ] }; } } - src/index.ts:1712-1722 (registration)Registration of list_dashboards in the ListToolsRequestSchema handler, defining its name, description, and inputSchema.
{ name: "list_dashboards", description: "List all available dashboards in Redash", inputSchema: { type: "object", properties: { page: { type: "number", description: "Page number (starts at 1)" }, pageSize: { type: "number", description: "Number of results per page" } } } }, - src/index.ts:2364-2366 (registration)Routing of 'list_dashboards' tool call to the listDashboards handler with schema validation in the CallToolRequestSchema switch statement.
case "list_dashboards": logger.debug(`Handling list_dashboards`); return await listDashboards(listDashboardsSchema.parse(args)); - src/redashClient.ts:582-599 (helper)The getDashboards method on the RedashClient class that makes the actual HTTP GET request to /api/dashboards with pagination params.
// Get all dashboards async getDashboards(page = 1, pageSize = 25): Promise<{ count: number; page: number; pageSize: number; results: RedashDashboard[] }> { try { const response = await this.client.get('/api/dashboards', { params: { page, page_size: pageSize } }); return { count: response.data.count, page: response.data.page, pageSize: response.data.page_size, results: response.data.results }; } catch (error) { console.error('Error fetching dashboards:', error); throw new Error('Failed to fetch dashboards from Redash'); } }