lightdash_get_custom_metrics
Retrieve custom metrics for a Lightdash analytics project to enhance data analysis and reporting capabilities.
Instructions
Get custom metrics 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:262-290 (handler)Handler function that parses input with GetCustomMetricsRequestSchema, fetches custom metrics from Lightdash API endpoint '/api/v1/projects/{projectUuid}/custom-metrics', handles errors, and returns JSON results as text content.case 'lightdash_get_custom_metrics': { const args = GetCustomMetricsRequestSchema.parse( request.params.arguments ); const { data, error } = await lightdashClient.GET( '/api/v1/projects/{projectUuid}/custom-metrics', { 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:41-48 (schema)Zod schema defining the input parameters for the tool, requiring a projectUuid (UUID string).export const GetCustomMetricsRequestSchema = z.object({ projectUuid: z .string() .uuid() .describe( 'The UUID of the project. You can obtain it from the project list.' ), });
- src/mcp.ts:74-78 (registration)Tool registration in the ListTools response, specifying name, description, and input schema converted to JSON schema.{ name: 'lightdash_get_custom_metrics', description: 'Get custom metrics for a project', inputSchema: zodToJsonSchema(GetCustomMetricsRequestSchema), },