fork_dashboard
Duplicate an existing Redash dashboard by providing its ID. Create a copy to modify or reuse without affecting the original.
Instructions
Fork (duplicate) an existing dashboard
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dashboardId | Yes | ID of the dashboard to fork |
Implementation Reference
- src/index.ts:736-749 (handler)The MCP tool handler function for fork_dashboard. Validates input with forkDashboardSchema, calls redashClient.forkDashboard(), and returns the result as JSON text.
async function forkDashboard(params: z.infer<typeof forkDashboardSchema>) { try { const result = await redashClient.forkDashboard(params.dashboardId); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { logger.error(`Error forking dashboard ${params.dashboardId}: ${error}`); return { isError: true, content: [{ type: "text", text: `Error forking dashboard ${params.dashboardId}: ${error instanceof Error ? error.message : String(error)}` }] }; } } - src/index.ts:732-734 (schema)Zod schema for fork_dashboard input validation. Expects a single 'dashboardId' field which is coerced to a number.
const forkDashboardSchema = z.object({ dashboardId: z.coerce.number() }); - src/index.ts:1863-1873 (registration)Tool registration in the ListToolsRequestSchema handler. Declares fork_dashboard with its name, description, and JSON Schema input.
{ name: "fork_dashboard", description: "Fork (duplicate) an existing dashboard", inputSchema: { type: "object", properties: { dashboardId: { type: "number", description: "ID of the dashboard to fork" } }, required: ["dashboardId"] } }, - src/index.ts:2410-2412 (registration)Tool dispatch in CallToolRequestSchema handler. Routes the 'fork_dashboard' tool name to the forkDashboard handler function with schema validation.
case "fork_dashboard": logger.debug(`Handling fork_dashboard`); return await forkDashboard(forkDashboardSchema.parse(args)); - src/redashClient.ts:792-800 (helper)The RedashClient method that makes the actual HTTP POST request to /api/dashboards/{dashboardId}/fork to fork a dashboard. It returns the forked dashboard data.
async forkDashboard(dashboardId: number): Promise<RedashDashboard> { try { const response = await this.client.post(`/api/dashboards/${dashboardId}/fork`); return response.data; } catch (error) { logger.error(`Error forking dashboard ${dashboardId}: ${error}`); throw new Error(`Failed to fork dashboard ${dashboardId}: ${error instanceof Error ? error.message : String(error)}`); } }