add_dashboard_favorite
Add a dashboard to your favorites by specifying its dashboard ID. This marks the dashboard for quick access in your favorites list.
Instructions
Add a dashboard to favorites
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dashboardId | Yes | ID of the dashboard to add to favorites |
Implementation Reference
- src/index.ts:853-855 (schema)Zod schema for the add_dashboard_favorite tool, requiring a single 'dashboardId' (coerced number) parameter.
// Tool: add_dashboard_favorite const addDashboardFavoriteSchema = z.object({ dashboardId: z.coerce.number() - src/index.ts:857-871 (handler)Handler function (addDashboardFavorite) that validates args via the schema, calls redashClient.addDashboardFavorite(), and returns success/error response.
async function addDashboardFavorite(params: z.infer<typeof addDashboardFavoriteSchema>) { try { const result = await redashClient.addDashboardFavorite(params.dashboardId); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { logger.error(`Error adding dashboard ${params.dashboardId} to favorites: ${error}`); return { isError: true, content: [{ type: "text", text: `Error adding dashboard ${params.dashboardId} to favorites: ${error instanceof Error ? error.message : String(error)}` }] }; } } - src/index.ts:1929-1939 (registration)Tool registration in ListToolsRequestSchema: defines tool name 'add_dashboard_favorite', description, and inputSchema for the MCP tool listing.
{ name: "add_dashboard_favorite", description: "Add a dashboard to favorites", inputSchema: { type: "object", properties: { dashboardId: { type: "number", description: "ID of the dashboard to add to favorites" } }, required: ["dashboardId"] } }, - src/index.ts:2434-2436 (registration)Tool dispatch handler in CallToolRequestSchema: routes 'add_dashboard_favorite' tool calls to the addDashboardFavorite function.
case "add_dashboard_favorite": logger.debug(`Handling add_dashboard_favorite`); return await addDashboardFavorite(addDashboardFavoriteSchema.parse(args)); - src/redashClient.ts:871-880 (helper)Redash API client method addDashboardFavorite() that makes the POST request to /api/dashboards/{dashboardId}/favorite to add the dashboard to favorites.
// Add dashboard to favorites async addDashboardFavorite(dashboardId: number): Promise<{ success: boolean }> { try { await this.client.post(`/api/dashboards/${dashboardId}/favorite`); return { success: true }; } catch (error) { logger.error(`Error adding dashboard ${dashboardId} to favorites: ${error}`); throw new Error(`Failed to add dashboard ${dashboardId} to favorites: ${error instanceof Error ? error.message : String(error)}`); } }