Skip to main content
Glama
mendeel

Mixpanel MCP

by mendeel

get_today_top_events

Retrieve today's most active events from Mixpanel to identify trends and monitor real-time user activity for data-driven insights.

Instructions

Get today's top events from Mixpanel. Useful for quickly identifying the most active events happening today, spotting trends, and monitoring real-time user activity.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idNoThe Mixpanel project ID. Optional since it has a default.
typeNoThe type of events to fetch, either general, average, or unique, defaults to general
limitNoMaximum number of events to return

Implementation Reference

  • The handler function that executes the tool logic by making a GET request to Mixpanel's /events/top endpoint to fetch today's top events.
    async function handleGetTodayTopEvents(args: any, config: any) {
      const { project_id = config.DEFAULT_PROJECT_ID, type = "general", limit = 10 } = args;
      
      try {
        // Create authorization header using base64 encoding of credentials
        const credentials = `${config.SERVICE_ACCOUNT_USER_NAME}:${config.SERVICE_ACCOUNT_PASSWORD}`;
        const encodedCredentials = Buffer.from(credentials).toString('base64');
        
        // Construct URL with query parameters
        const url = `${config.MIXPANEL_BASE_URL}/events/top?project_id=${project_id}&type=${type}${limit ? `&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(`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 events:", error);
        const errorMessage = error instanceof Error ? error.message : String(error);
        return {
          content: [
            {
              type: "text",
              text: `Error fetching Mixpanel events: ${errorMessage}`
            }
          ],
          isError: true
        };
      }
    }
  • src/index.ts:606-607 (registration)
    The switch case in the CallToolRequestSchema handler that routes calls to the get_today_top_events tool to its handler function.
    case "get_today_top_events":
      return await handleGetTodayTopEvents(args, { SERVICE_ACCOUNT_USER_NAME, SERVICE_ACCOUNT_PASSWORD, DEFAULT_PROJECT_ID, MIXPANEL_BASE_URL });
  • The tool registration in the ListToolsRequestSchema response, including name, description, and input schema definition.
      name: "get_today_top_events",
      description: "Get today's top events from Mixpanel. Useful for quickly identifying the most active events happening today, spotting trends, and monitoring real-time user activity.",
      inputSchema: {
        type: "object",
        properties: {
          project_id: {
            type: "string",
            description: "The Mixpanel project ID. Optional since it has a default."
          },
          type: {
            type: "string",
            enum: ["general", "average", "unique"],
            description: "The type of events to fetch, either general, average, or unique, defaults to general"
          },
          limit: {
            type: "number",
            description: "Maximum number of events to return"
          }
        }
      }
    },
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions the tool is for 'quickly identifying' and 'real-time activity,' hinting at efficiency, but fails to disclose critical behavioral traits: whether it's read-only, potential rate limits, authentication needs, data freshness, or what 'top' means (e.g., by count, revenue). For a tool with no annotations, this is a significant gap in transparency.

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 and front-loaded: the first sentence states the core purpose, followed by a second sentence explaining use cases. Both sentences earn their place by adding value, with no redundant or vague language. However, it could be slightly more structured by separating purpose from guidelines.

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 no annotations, no output schema, and 3 parameters with full schema coverage, the description is moderately complete. It covers the purpose and usage context adequately but lacks behavioral details (e.g., safety, performance) and output information, which are important for a tool fetching real-time data. This leaves gaps for an AI agent to fully understand the tool's behavior.

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 fully documents parameters (project_id, type, limit). The description adds no parameter-specific information beyond what's in the schema, such as explaining 'top' in relation to 'type' or 'limit.' With high schema coverage, the baseline is 3, as the description doesn't compensate but also doesn't detract.

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 today's top events from Mixpanel.' It specifies the resource (events) and temporal scope (today), and distinguishes it from siblings like 'get_top_events' by emphasizing 'today's' and real-time monitoring. However, it doesn't explicitly differentiate from all siblings like 'aggregate_event_counts' or 'query_insights_report'.

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 quickly identifying the most active events happening today, spotting trends, and monitoring real-time user activity.' This suggests when to use it (for real-time, top events analysis), but lacks explicit guidance on when not to use it or alternatives among siblings (e.g., vs. 'get_top_events' for non-today data or 'query_segmentation_report' for detailed analysis).

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

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

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