Skip to main content
Glama
dragonkhoi

mixpanel

aggregated_event_property_values

Analyze unique, general, or average values of a specific event property over time to assess performance, segment users, and identify key user attributes within Mixpanel.

Instructions

Get unique, general, or average data for a single event and property over days, weeks, or months. Useful for analyzing how specific properties affect event performance, segmenting users, and identifying valuable user attributes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
eventYesThe event that you wish to get data for (a single event name, not an array)
from_dateNoThe date in yyyy-mm-dd format to begin querying from (inclusive)
intervalNoThe number of units to return data for. Specify either interval or from_date and to_date
limitNoThe maximum number of values to return (default: 255)
nameYesThe name of the property you would like to get data for
project_idNoThe Mixpanel project ID. Optional since it has a default.
to_dateNoThe date in yyyy-mm-dd format to query to (inclusive)
typeNoThe analysis type - general, unique, or average events, defaults to general
unitYesThe level of granularity of the data (minute, hour, day, week, or month)
valuesNoThe specific property values to get data for, encoded as a JSON array. Example: "["female", "unknown"]"

Implementation Reference

  • src/index.ts:305-307 (registration)
    Registers the MCP tool named 'aggregated_event_property_values' with name, description, input schema, and handler function.
    server.tool(
      "aggregated_event_property_values",
      "Get unique, general, or average data for a single event and property over days, weeks, or months. Useful for analyzing how specific properties affect event performance, segmenting users, and identifying valuable user attributes.",
  • Zod input schema defining parameters for the aggregated_event_property_values tool.
    {
      project_id: z.string().describe("The Mixpanel project ID. Optional since it has a default.").optional(),
      event: z.string().describe("The event that you wish to get data for (a single event name, not an array)"),
      name: z.string().describe("The name of the property you would like to get data for"),
      values: z.string().optional().describe("The specific property values to get data for, encoded as a JSON array. Example: \"[\"female\", \"unknown\"]\""),
      type: z.enum(["general", "unique", "average"]).describe("The analysis type - general, unique, or average events, defaults to general").optional(),
      unit: z.enum(["minute", "hour", "day", "week", "month"]).describe("The level of granularity of the data (minute, hour, day, week, or month)"),
      interval: z.number().optional().describe("The number of units to return data for. Specify either interval or from_date and to_date"),
      from_date: z.string().optional().describe("The date in yyyy-mm-dd format to begin querying from (inclusive)"),
      to_date: z.string().optional().describe("The date in yyyy-mm-dd format to query to (inclusive)"),
      limit: z.number().optional().describe("The maximum number of values to return (default: 255)"),
    },
  • The handler function that implements the tool logic: validates parameters, parses JSON values if provided, builds query params for Mixpanel's /api/query/events/properties endpoint, makes authenticated GET request, returns JSON data or error response.
    async ({ project_id = DEFAULT_PROJECT_ID, event, name, values, type = "general", unit, interval, from_date, to_date, 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');
        
        // Validate parameters
        if (!interval && (!from_date || !to_date)) {
          throw new Error("You must specify either interval or both from_date and to_date");
        }
        
        // Parse values if provided
        let parsedValues;
        if (values) {
          try {
            parsedValues = JSON.parse(values);
            if (!Array.isArray(parsedValues)) {
              throw new Error("Values must be a JSON array");
            }
          } catch (e) {
            throw new Error(`Invalid values format: ${e instanceof Error ? e.message : String(e)}`);
          }
        }
        
        // Build query parameters
        const queryParams = new URLSearchParams({
          project_id: project_id || '',
          event: event,
          name: name,
          type: type,
          unit: unit
        });
        
        // Add values if provided
        if (values) {
          queryParams.append('values', values);
        }
        
        // Add either interval or date range
        if (interval) {
          queryParams.append('interval', interval.toString());
        } else {
          queryParams.append('from_date', from_date || '');
          queryParams.append('to_date', to_date || '');
        }
        
        // Add limit if provided
        if (limit) {
          queryParams.append('limit', limit.toString());
        }
        
        // Construct URL with query parameters
        const url = `https://mixpanel.com/api/query/events/properties?${queryParams.toString()}`;
        
        // 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(`HTTP error! status: ${response.status} - ${errorText}`);
        }
        
        const data = await response.json();
        
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(data)
            }
          ]
        };
      } catch (error: unknown) {
        console.error("Error fetching Mixpanel event property values:", error);
        const errorMessage = error instanceof Error ? error.message : String(error);
        return {
          content: [
            {
              type: "text",
              text: `Error fetching Mixpanel event property values: ${errorMessage}`
            }
          ],
          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. It mentions the tool returns data over time periods and has a default limit, but doesn't disclose critical behavioral traits: whether it's a read-only operation, potential rate limits, authentication needs, error conditions, or what the output format looks like (since no output schema exists). The description adds some context but leaves significant gaps for a tool with 10 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 sentence front-loads the core functionality, and the second provides usage context. There's minimal waste, though the second sentence could be more specific about differentiation from siblings.

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 tool's complexity (10 parameters, no annotations, no output schema), the description is incomplete. It doesn't explain what the tool returns, error handling, or how it differs from similar sibling tools. For an analytics tool with significant parameter complexity, more behavioral and contextual information would be needed for an agent to use it effectively.

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 10 parameters thoroughly. The description adds marginal value by mentioning 'days, weeks, or months' (mapping to the 'unit' parameter) and 'unique, general, or average' (mapping to 'type'), but doesn't provide additional semantics beyond what's in the schema. Baseline 3 is appropriate when 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 unique, general, or average data for a single event and property over days, weeks, or months.' It specifies the verb ('Get'), resource ('data for a single event and property'), and temporal scope. However, it doesn't explicitly differentiate from sibling tools like 'top_event_property_values' or 'query_segmentation_report', which appear related.

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 analyzing how specific properties affect event performance, segmenting users, and identifying valuable user attributes.' This suggests when to use it, but it doesn't explicitly state when NOT to use it or name alternatives among the many sibling tools. No prerequisites or exclusions are mentioned.

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