lightdash_get_charts_as_code
Retrieve chart definitions as machine-readable code from a Lightdash project by providing its UUID.
Instructions
Get charts as code for a project
Input 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:350-379 (handler)Case handler for 'lightdash_get_charts_as_code' tool. Parses arguments with GetChartsAsCodeRequestSchema, calls Lightdash API GET /api/v1/projects/{projectUuid}/charts/code, and returns the results as JSON text.
case 'lightdash_get_charts_as_code': { const args = GetChartsAsCodeRequestSchema.parse( request.params.arguments ); const { data, error } = await lightdashClient.GET( '/api/v1/projects/{projectUuid}/charts/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:68-75 (schema)Zod schema for GetChartsAsCodeRequestSchema, validating a projectUuid string (UUID format).
export const GetChartsAsCodeRequestSchema = z.object({ projectUuid: z .string() .uuid() .describe( 'The UUID of the project. You can obtain it from the project list.' ), }); - src/mcp.ts:89-93 (registration)Tool registration entry for 'lightdash_get_charts_as_code' with description and inputSchema.
{ name: 'lightdash_get_charts_as_code', description: 'Get charts as code for a project', inputSchema: zodToJsonSchema(GetChartsAsCodeRequestSchema), },