Skip to main content
Glama
mendeel

Mixpanel MCP

by mendeel

profile_event_activity

Retrieve event activity data for specific user profiles to analyze individual behavior patterns, troubleshoot user issues, and understand user journeys within Mixpanel.

Instructions

Get data for a profile's event activity. Useful for understanding individual user journeys, troubleshooting user-specific issues, and analyzing behavior patterns of specific users.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idNoThe Mixpanel project ID. Optional since it has a default.
workspace_idNoThe ID of the workspace if applicable
distinct_idsYesA JSON array as a string representing the distinct_ids to return activity feeds for. Example: ["12a34aa567eb8d-9ab1c26f345b67-89123c45-6aeaa7-89f12af345f678"]
from_dateYesThe date in yyyy-mm-dd format to begin querying from (inclusive)
to_dateYesThe date in yyyy-mm-dd format to query to (inclusive)

Implementation Reference

  • The handler function that implements the core logic for the 'profile_event_activity' tool. It makes an authenticated GET request to the Mixpanel /stream/query endpoint to fetch event activity for specified distinct_ids over a date range.
    async function handleProfileEventActivity(args: any, config: any) {
      const { project_id = config.DEFAULT_PROJECT_ID, workspace_id, distinct_ids, from_date, to_date } = 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
        let url = `${config.MIXPANEL_BASE_URL}/stream/query?project_id=${project_id}&distinct_ids=${encodeURIComponent(distinct_ids)}&from_date=${from_date}&to_date=${to_date}`;
        
        // Add optional workspace_id if provided
        if (workspace_id) {
          url += `&workspace_id=${workspace_id}`;
        }
        
        // 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 profile event activity:', error);
        const errorMessage = error instanceof Error ? error.message : String(error);
        return {
          content: [
            {
              type: "text",
              text: `Error fetching profile event activity: ${errorMessage}`
            }
          ],
          isError: true
        };
      }
    }
  • The input schema definition and metadata for the 'profile_event_activity' tool, including description and required parameters, registered in the MCP tools list.
      name: "profile_event_activity",
      description: "Get data for a profile's event activity. Useful for understanding individual user journeys, troubleshooting user-specific issues, and analyzing behavior patterns of specific users.",
      inputSchema: {
        type: "object",
        properties: {
          project_id: {
            type: "string",
            description: "The Mixpanel project ID. Optional since it has a default."
          },
          workspace_id: {
            type: "string",
            description: "The ID of the workspace if applicable"
          },
          distinct_ids: {
            type: "string",
            description: "A JSON array as a string representing the distinct_ids to return activity feeds for. Example: [\"12a34aa567eb8d-9ab1c26f345b67-89123c45-6aeaa7-89f12af345f678\"]"
          },
          from_date: {
            type: "string",
            description: "The date in yyyy-mm-dd format to begin querying from (inclusive)"
          },
          to_date: {
            type: "string",
            description: "The date in yyyy-mm-dd format to query to (inclusive)"
          }
        },
        required: ["distinct_ids", "from_date", "to_date"]
      }
    },
  • src/index.ts:619-620 (registration)
    The switch case in the tool request handler that dispatches calls to the 'profile_event_activity' handler function.
    case "profile_event_activity":
      return await handleProfileEventActivity(args, { SERVICE_ACCOUNT_USER_NAME, SERVICE_ACCOUNT_PASSWORD, DEFAULT_PROJECT_ID, MIXPANEL_BASE_URL });
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 states the tool retrieves data ('Get data') but doesn't disclose behavioral traits like whether this is a read-only operation, potential rate limits, authentication requirements, or what format the returned data takes. The description is functional but lacks operational transparency needed for a tool with no annotation coverage.

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 concise with two sentences. The first sentence states the core purpose, and the second provides use case context. Both sentences add value without redundancy. It could be slightly more front-loaded by mentioning key constraints earlier, but overall it's well-structured and efficient.

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 5 parameters with full schema coverage but no annotations and no output schema, the description provides adequate purpose and context but lacks behavioral and output information. For a data retrieval tool with multiple parameters, the description should ideally mention what kind of data structure is returned or any limitations. It's minimally viable but has clear gaps in operational 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 thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema. This meets the baseline expectation when schema coverage is complete, but doesn't provide additional semantic context about how parameters interact or affect results.

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 data for a profile's event activity' (verb+resource). It distinguishes from siblings by focusing on individual user journeys rather than aggregated data, but doesn't explicitly name alternatives. The description adds context about use cases (understanding journeys, troubleshooting, analyzing behavior), which enhances clarity beyond a basic statement.

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 implies usage context ('useful for understanding individual user journeys...') which suggests when to use it, but doesn't explicitly state when NOT to use it or name specific alternatives. It doesn't provide clear guidance on choosing between this tool and sibling tools like query_profiles or aggregated_event_property_values for similar purposes.

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