Skip to main content
Glama
dragonkhoi

mixpanel

top_event_property_values

Identify the top values of a specific property within Mixpanel data to analyze value distribution, uncover common categories, and plan targeted insights.

Instructions

Get the top values for a property. Useful for understanding the distribution of values for a specific property, identifying the most common categories or segments, and planning further targeted analyses.

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 values to return. Defaults to 255
nameYesThe name of the property you would like to get data for
project_idNoThe Mixpanel project ID
workspace_idNoThe ID of the workspace if applicable

Implementation Reference

  • The handler function for the 'top_event_property_values' tool. It makes a GET request to Mixpanel's API endpoint '/api/query/events/properties/values' with the provided event name and property name, authenticates using service account credentials, and returns the top property values or an error.
      async ({ 
        project_id = DEFAULT_PROJECT_ID, 
        workspace_id, 
        event, 
        name,
        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/values?project_id=${project_id}&event=${encodeURIComponent(event)}&name=${encodeURIComponent(name)}`;
          
          // 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 property values:', error);
          return {
            content: [
              {
                type: "text",
                text: `Error fetching top event property values: ${error}`
              }
            ],
            isError: true
          };
        }
      }
    );
  • Zod schema defining the input parameters for the 'top_event_property_values' tool, including project_id, workspace_id, event, name, and optional limit.
    {
      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"),
      name: z.string().describe("The name of the property you would like to get data for"),
      limit: z.number().describe("The maximum number of values to return. Defaults to 255").optional(),
    },
  • src/index.ts:1472-1540 (registration)
    Registration of the 'top_event_property_values' tool using server.tool(), including name, description, input schema, and handler function.
    server.tool(
      "top_event_property_values",
      "Get the top values for a property. Useful for understanding the distribution of values for a specific property, identifying the most common categories or segments, and planning further targeted analyses.",
      {
        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"),
        name: z.string().describe("The name of the property you would like to get data for"),
        limit: z.number().describe("The maximum number of values to return. Defaults to 255").optional(),
      },
      async ({ 
        project_id = DEFAULT_PROJECT_ID, 
        workspace_id, 
        event, 
        name,
        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/values?project_id=${project_id}&event=${encodeURIComponent(event)}&name=${encodeURIComponent(name)}`;
          
          // 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 property values:', error);
          return {
            content: [
              {
                type: "text",
                text: `Error fetching top event property values: ${error}`
              }
            ],
            isError: true
          };
        }
      }
    );
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 mentions the tool is 'useful for understanding distribution' and 'planning further analyses,' which implies it's a read-only operation, but doesn't explicitly state this, nor does it cover permissions, rate limits, or response format. The description adds some context about use cases but lacks critical behavioral details for a tool with 5 parameters.

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 appropriately sized with two sentences: the first states the purpose, and the second explains use cases. It's front-loaded with the core function and avoids unnecessary details, though it could be slightly more concise by integrating the use cases more tightly.

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

Completeness3/5

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

Given the tool's complexity (5 parameters, no annotations, no output schema), the description is minimally adequate. It covers the purpose and use cases but lacks details on behavioral traits, output format, and explicit sibling differentiation. It's complete enough for basic understanding but leaves gaps for effective agent invocation without additional context.

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?

Schema description coverage is 100%, so the schema already documents all 5 parameters (event, limit, name, project_id, workspace_id) with descriptions. The description adds no specific parameter semantics beyond what's in the schema, such as explaining property name constraints or event selection criteria. Baseline 3 is appropriate when the schema does the heavy lifting.

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 values for a property.' It specifies the verb ('Get') and resource ('top values for a property'), and distinguishes it from siblings like 'top_event_properties' by focusing on values rather than properties themselves. However, it doesn't explicitly differentiate from tools like 'query_segmentation_report' that might also analyze property distributions.

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 context: 'Useful for understanding the distribution of values for a specific property, identifying the most common categories or segments, and planning further targeted analyses.' This suggests when to use it (for exploratory data analysis), but it doesn't explicitly state when not to use it or name alternatives among the many sibling tools, such as 'aggregated_event_property_values' or 'query_segmentation_report'.

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