update_dashboard
Update a Redash dashboard by modifying its name, tags, archive status, draft status, or filter settings.
Instructions
Update an existing dashboard in Redash
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dashboardId | Yes | ID of the dashboard to update | |
| name | No | New name of the dashboard | |
| tags | No | Tags for the dashboard | |
| is_archived | No | Whether the dashboard is archived | |
| is_draft | No | Whether the dashboard is a draft | |
| dashboard_filters_enabled | No | Whether dashboard filters are enabled |
Implementation Reference
- src/index.ts:688-709 (handler)The main handler function for the 'update_dashboard' MCP tool. It parses the incoming parameters (dashboardId and optional fields), builds an UpdateDashboardRequest object with only the fields that are provided, calls redashClient.updateDashboard(), and returns the result or an error.
async function updateDashboard(params: z.infer<typeof updateDashboardSchema>) { try { const { dashboardId, ...updateData } = params; const dashboardData: UpdateDashboardRequest = {}; if (updateData.name !== undefined) dashboardData.name = updateData.name; if (updateData.tags !== undefined) dashboardData.tags = updateData.tags; if (updateData.is_archived !== undefined) dashboardData.is_archived = updateData.is_archived; if (updateData.is_draft !== undefined) dashboardData.is_draft = updateData.is_draft; if (updateData.dashboard_filters_enabled !== undefined) dashboardData.dashboard_filters_enabled = updateData.dashboard_filters_enabled; const result = await redashClient.updateDashboard(dashboardId, dashboardData); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { logger.error(`Error updating dashboard ${params.dashboardId}: ${error}`); return { isError: true, content: [{ type: "text", text: `Error updating dashboard ${params.dashboardId}: ${error instanceof Error ? error.message : String(error)}` }] }; } } - src/index.ts:679-686 (schema)Zod schema for validating input parameters to the 'update_dashboard' tool. Defines dashboardId (required), and optional fields: name, tags, is_archived, is_draft, dashboard_filters_enabled.
const updateDashboardSchema = z.object({ dashboardId: z.coerce.number(), name: z.string().optional(), tags: z.array(z.string()).optional(), is_archived: z.boolean().optional(), is_draft: z.boolean().optional(), dashboard_filters_enabled: z.boolean().optional() }); - src/index.ts:1836-1851 (registration)Registration of the 'update_dashboard' tool in the ListToolsRequestSchema handler, defining the tool name, description, and input JSON schema for the MCP protocol.
{ name: "update_dashboard", description: "Update an existing dashboard in Redash", inputSchema: { type: "object", properties: { dashboardId: { type: "number", description: "ID of the dashboard to update" }, name: { type: "string", description: "New name of the dashboard" }, tags: { type: "array", items: { type: "string" }, description: "Tags for the dashboard" }, is_archived: { type: "boolean", description: "Whether the dashboard is archived" }, is_draft: { type: "boolean", description: "Whether the dashboard is a draft" }, dashboard_filters_enabled: { type: "boolean", description: "Whether dashboard filters are enabled" } }, required: ["dashboardId"] } }, - src/index.ts:2402-2404 (registration)Registration of the 'update_dashboard' case in the CallToolRequestSchema switch statement, which routes incoming tool calls to the updateDashboard handler.
case "update_dashboard": logger.debug(`Handling update_dashboard`); return await updateDashboard(updateDashboardSchema.parse(args)); - src/redashClient.ts:769-778 (helper)Client-side helper method that makes the actual HTTP POST request to the Redash API to update a dashboard. Called by the handler function.
// Update an existing dashboard async updateDashboard(dashboardId: number, data: UpdateDashboardRequest): Promise<RedashDashboard> { try { const response = await this.client.post(`/api/dashboards/${dashboardId}`, data); return response.data; } catch (error) { logger.error(`Error updating dashboard ${dashboardId}: ${error}`); throw new Error(`Failed to update dashboard ${dashboardId}: ${error instanceof Error ? error.message : String(error)}`); } } - src/redashClient.ts:130-136 (schema)TypeScript interface defining the shape of the UpdateDashboardRequest payload sent to the Redash API.
export interface UpdateDashboardRequest { name?: string; tags?: string[]; is_archived?: boolean; is_draft?: boolean; dashboard_filters_enabled?: boolean; }