Skip to main content
Glama
dragonkhoi

mixpanel

top_event_properties

Identify and retrieve the most common properties associated with a specific event in Mixpanel analytics. Prioritize key dimensions for analysis and gain insights into event structure efficiently.

Instructions

Get the top property names for an event. Useful for discovering which properties are most commonly associated with an event, prioritizing which dimensions to analyze, and understanding event structure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
eventYesThe event that you wish to get data for. Note: this is a single event name, not an array
limitNoThe maximum number of properties to return. Defaults to 10
project_idNoThe Mixpanel project ID
workspace_idNoThe ID of the workspace if applicable

Implementation Reference

  • src/index.ts:1405-1470 (registration)
    Registration of the 'top_event_properties' MCP tool using server.tool(), including description, input schema, and handler function.
      "top_event_properties",
      "Get the top property names for an event. Useful for discovering which properties are most commonly associated with an event, prioritizing which dimensions to analyze, and understanding event structure.",
      {
        project_id: z.string().describe("The Mixpanel project ID").optional(),
        workspace_id: z.string().describe("The ID of the workspace if applicable").optional(),
        event: z.string().describe("The event that you wish to get data for. Note: this is a single event name, not an array"),
        limit: z.number().describe("The maximum number of properties to return. Defaults to 10").optional(),
      },
      async ({ 
        project_id = DEFAULT_PROJECT_ID, 
        workspace_id, 
        event, 
        limit 
      }) => {
        try {
          // Create authorization header using base64 encoding of credentials
          const credentials = `${SERVICE_ACCOUNT_USER_NAME}:${SERVICE_ACCOUNT_PASSWORD}`;
          const encodedCredentials = Buffer.from(credentials).toString('base64');
          
          // Construct base URL with required parameters
          let url = `https://mixpanel.com/api/query/events/properties/top?project_id=${project_id}&event=${encodeURIComponent(event)}`;
          
          // Add optional parameters if they exist
          if (workspace_id) url += `&workspace_id=${workspace_id}`;
          if (limit !== undefined) url += `&limit=${limit}`;
          
          // Set up request options
          const options = {
            method: 'GET',
            headers: {
              'accept': 'application/json',
              'authorization': `Basic ${encodedCredentials}`
            }
          };
          
          // Make the API request
          const response = await fetch(url, options);
          
          if (!response.ok) {
            const errorText = await response.text();
            throw new Error(`API request failed with status ${response.status}: ${errorText}`);
          }
          
          const data = await response.json();
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(data)
              }
            ]
          };
        } catch (error) {
          console.error('Error fetching top event properties:', error);
          return {
            content: [
              {
                type: "text",
                text: `Error fetching top event properties: ${error}`
              }
            ],
            isError: true
          };
        }
      }
    );
  • The core handler function for the top_event_properties tool. It authenticates with Mixpanel using service account credentials, constructs the API URL for /query/events/properties/top, fetches the data, and returns the JSON response or error.
    async ({ 
      project_id = DEFAULT_PROJECT_ID, 
      workspace_id, 
      event, 
      limit 
    }) => {
      try {
        // Create authorization header using base64 encoding of credentials
        const credentials = `${SERVICE_ACCOUNT_USER_NAME}:${SERVICE_ACCOUNT_PASSWORD}`;
        const encodedCredentials = Buffer.from(credentials).toString('base64');
        
        // Construct base URL with required parameters
        let url = `https://mixpanel.com/api/query/events/properties/top?project_id=${project_id}&event=${encodeURIComponent(event)}`;
        
        // Add optional parameters if they exist
        if (workspace_id) url += `&workspace_id=${workspace_id}`;
        if (limit !== undefined) url += `&limit=${limit}`;
        
        // Set up request options
        const options = {
          method: 'GET',
          headers: {
            'accept': 'application/json',
            'authorization': `Basic ${encodedCredentials}`
          }
        };
        
        // Make the API request
        const response = await fetch(url, options);
        
        if (!response.ok) {
          const errorText = await response.text();
          throw new Error(`API request failed with status ${response.status}: ${errorText}`);
        }
        
        const data = await response.json();
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(data)
            }
          ]
        };
      } catch (error) {
        console.error('Error fetching top event properties:', error);
        return {
          content: [
            {
              type: "text",
              text: `Error fetching top event properties: ${error}`
            }
          ],
          isError: true
        };
      }
    }
  • Zod input schema validation for the top_event_properties tool parameters.
    {
      project_id: z.string().describe("The Mixpanel project ID").optional(),
      workspace_id: z.string().describe("The ID of the workspace if applicable").optional(),
      event: z.string().describe("The event that you wish to get data for. Note: this is a single event name, not an array"),
      limit: z.number().describe("The maximum number of properties to return. Defaults to 10").optional(),
    },
  • JSON Schema for the underlying Mixpanel API endpoint /query/events/properties/top, which defines the request parameters and response format used by the tool handler.
    declare const QueryEventsTopProperties: {
        readonly metadata: {
            readonly allOf: readonly [{
                readonly type: "object";
                readonly properties: {
                    readonly project_id: {
                        readonly type: "integer";
                        readonly $schema: "http://json-schema.org/draft-04/schema#";
                        readonly description: "Required if using service account to authenticate request.";
                    };
                    readonly workspace_id: {
                        readonly type: "integer";
                        readonly $schema: "http://json-schema.org/draft-04/schema#";
                        readonly description: "The id of the workspace if applicable.";
                    };
                    readonly event: {
                        readonly type: "string";
                        readonly $schema: "http://json-schema.org/draft-04/schema#";
                        readonly description: "The event that you wish to get data for. Note: this is a single event name, not an array.";
                    };
                    readonly limit: {
                        readonly type: "integer";
                        readonly $schema: "http://json-schema.org/draft-04/schema#";
                        readonly description: "The maximum number of properties to return. Defaults to 10.";
                    };
                };
                readonly required: readonly ["project_id", "event"];
            }];
        };
        readonly response: {
            readonly "200": {
                readonly type: "object";
                readonly description: "The keys are the name of the properties";
                readonly additionalProperties: {
                    readonly type: "object";
                    readonly properties: {
                        readonly count: {
                            readonly type: "integer";
                            readonly description: "The number of events with that property";
                        };
                    };
                };
                readonly $schema: "http://json-schema.org/draft-04/schema#";
            };
        };
    };
  • Generated SDK helper method queryEventsTopProperties that wraps the Mixpanel API call to /events/properties/top, though not directly used in the MCP implementation.
     * @summary Top Event Properties
     */
    queryEventsTopProperties(metadata) {
        return this.core.fetch('/events/properties/top', 'get', metadata);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It describes the tool's purpose and usefulness but lacks details on behavioral traits like authentication requirements, rate limits, error handling, or what the output looks like (e.g., format, ordering). For a tool with no annotations, this leaves significant gaps in understanding how it behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded, starting with the core purpose ('Get the top property names for an event.') followed by usefulness context. Both sentences earn their place by clarifying intent and application, with no wasted words, though it could be slightly more structured for clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a data analysis tool with 4 parameters, no annotations, and no output schema, the description is incomplete. It lacks details on output format, behavioral constraints, and explicit differentiation from siblings. While it covers purpose and usage context, it doesn't provide enough information for an agent to fully understand how to use the tool effectively in practice.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so the input schema already documents all parameters well. The description doesn't add any parameter-specific semantics beyond what's in the schema, such as explaining 'event' beyond being a single name or 'limit' beyond its default. With high schema coverage, the baseline score of 3 is appropriate, as the description doesn't compensate but doesn't need to heavily.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get the top property names for an event.' It specifies the verb ('Get') and resource ('top property names for an event'), making it easy to understand. However, it doesn't explicitly differentiate from its sibling 'top_event_property_values' (which returns values rather than names), leaving some ambiguity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage guidelines by stating it's 'Useful for discovering which properties are most commonly associated with an event, prioritizing which dimensions to analyze, and understanding event structure.' This gives context on when to use it, but it doesn't explicitly mention when not to use it or name alternatives among the sibling tools, such as 'top_event_property_values' for property values instead of names.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/dragonkhoi/mixpanel-mcp'

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