lightdash_get_dashboards_as_code
Export Lightdash dashboards as code files to enable version control, automate deployments, and maintain consistency across environments.
Instructions
Get dashboards as code for a project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectUuid | Yes | The UUID of the project. You can obtain it from the project list. |
Implementation Reference
- src/mcp.ts:380-408 (handler)The switch case that handles execution of the 'lightdash_get_dashboards_as_code' tool by parsing arguments, calling the Lightdash API endpoint '/api/v1/projects/{projectUuid}/dashboards/code', and returning the results as JSON.case 'lightdash_get_dashboards_as_code': { const args = GetDashboardsAsCodeRequestSchema.parse( request.params.arguments ); const { data, error } = await lightdashClient.GET( '/api/v1/projects/{projectUuid}/dashboards/code', { params: { path: { projectUuid: args.projectUuid, }, }, } ); if (error) { throw new Error( `Lightdash API error: ${error.error.name}, ${ error.error.message ?? 'no message' }` ); } return { content: [ { type: 'text', text: JSON.stringify(data.results, null, 2), }, ], };
- src/schemas.ts:77-84 (schema)Zod schema for input validation of the tool, requiring a projectUuid.export const GetDashboardsAsCodeRequestSchema = z.object({ projectUuid: z .string() .uuid() .describe( 'The UUID of the project. You can obtain it from the project list.' ), });
- src/mcp.ts:94-98 (registration)Tool registration in the listTools response, specifying name, description, and input schema.{ name: 'lightdash_get_dashboards_as_code', description: 'Get dashboards as code for a project', inputSchema: zodToJsonSchema(GetDashboardsAsCodeRequestSchema), },