Skip to main content
Glama
syucream

Lightdash MCP Server

by syucream

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
NameRequiredDescriptionDefault
projectUuidYesThe UUID of the project. You can obtain it from the project list.
tableYes

Implementation Reference

  • 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),
          },
        ],
      };
    }
  • 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),
    },

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