lightdash_get_analytics
Retrieve analytics data for a specific table in your Lightdash project to analyze metrics and performance insights.
Instructions
Get analytics for a specific table in the data catalog
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectUuid | Yes | The UUID of the project. You can obtain it from the project list. | |
| table | Yes |
Implementation Reference
- src/mcp.ts:439-469 (handler)Handler function that parses input arguments using GetAnalyticsRequestSchema, calls the Lightdash API endpoint '/api/v1/projects/{projectUuid}/dataCatalog/{table}/analytics' with projectUuid and table parameters, handles errors, and returns the results as JSON text.case 'lightdash_get_analytics': { const args = GetAnalyticsRequestSchema.parse( request.params.arguments ); const { data, error } = await lightdashClient.GET( '/api/v1/projects/{projectUuid}/dataCatalog/{table}/analytics', { params: { path: { projectUuid: args.projectUuid, table: args.table, }, }, } ); 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:96-104 (schema)Zod schema for input validation: requires projectUuid (UUID string with description) and table (string).export const GetAnalyticsRequestSchema = z.object({ projectUuid: z .string() .uuid() .describe( 'The UUID of the project. You can obtain it from the project list.' ), table: z.string(), });
- src/mcp.ts:104-108 (registration)Registration of the 'lightdash_get_analytics' tool in the MCP server's tool list, specifying name, description, and input schema derived from GetAnalyticsRequestSchema.{ name: 'lightdash_get_analytics', description: 'Get analytics for a specific table in the data catalog', inputSchema: zodToJsonSchema(GetAnalyticsRequestSchema), },