Skip to main content
Glama
syucream

Lightdash MCP Server

by syucream

lightdash_get_charts_as_code

Export Lightdash charts as code for a project to enable version control, automation, and programmatic management of analytics visualizations.

Instructions

Get charts as code for a project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectUuidYesThe UUID of the project. You can obtain it from the project list.

Implementation Reference

  • Handler for 'lightdash_get_charts_as_code' tool: parses input schema, calls Lightdash API to get charts as code for a project, returns JSON response.
    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), }, ], }; }
  • Input schema validation using Zod for the tool, requiring a projectUuid.
    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)
    Registration of the tool in the MCP server's listTools handler.
    { name: 'lightdash_get_charts_as_code', description: 'Get charts as code for a project', inputSchema: zodToJsonSchema(GetChartsAsCodeRequestSchema), },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/syucream/lightdash-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server