Skip to main content
Glama
dragonkhoi

mixpanel

profile_event_activity

Analyze individual user event activity to track behavior, troubleshoot issues, and understand user journeys by querying Mixpanel data.

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
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)
project_idNoThe Mixpanel project ID. Optional since it has a default.
to_dateYesThe date in yyyy-mm-dd format to query to (inclusive)
workspace_idNoThe ID of the workspace if applicable

Implementation Reference

  • The asynchronous handler function that implements the core logic of the 'profile_event_activity' tool by making authenticated GET requests to Mixpanel's profile event activity API endpoint.
    async ({ project_id = DEFAULT_PROJECT_ID, workspace_id, distinct_ids, from_date, to_date }) => {
      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 URL with query parameters
        let url = `https://mixpanel.com/api/query/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
        };
      }
    }
  • Zod input schema defining parameters for the 'profile_event_activity' tool: project_id (optional), workspace_id (optional), distinct_ids (required JSON string), from_date (required), to_date (required).
    {
      project_id: z.string().describe("The Mixpanel project ID. Optional since it has a default.").optional(),
      workspace_id: z.string().describe("The ID of the workspace if applicable").optional(),
      distinct_ids: z.string().describe("A JSON array as a string representing the `distinct_ids` to return activity feeds for. Example: `[\"12a34aa567eb8d-9ab1c26f345b67-89123c45-6aeaa7-89f12af345f678\"]`"),
      from_date: z.string().describe("The date in yyyy-mm-dd format to begin querying from (inclusive)"),
      to_date: z.string().describe("The date in yyyy-mm-dd format to query to (inclusive)"),
    },
  • src/index.ts:81-145 (registration)
    Registration of the 'profile_event_activity' MCP tool using server.tool(), including name, description, input schema, and inline handler function.
    server.tool(
      "profile_event_activity",
      "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.",
      {
        project_id: z.string().describe("The Mixpanel project ID. Optional since it has a default.").optional(),
        workspace_id: z.string().describe("The ID of the workspace if applicable").optional(),
        distinct_ids: z.string().describe("A JSON array as a string representing the `distinct_ids` to return activity feeds for. Example: `[\"12a34aa567eb8d-9ab1c26f345b67-89123c45-6aeaa7-89f12af345f678\"]`"),
        from_date: z.string().describe("The date in yyyy-mm-dd format to begin querying from (inclusive)"),
        to_date: z.string().describe("The date in yyyy-mm-dd format to query to (inclusive)"),
      },
      async ({ project_id = DEFAULT_PROJECT_ID, workspace_id, distinct_ids, from_date, to_date }) => {
        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 URL with query parameters
          let url = `https://mixpanel.com/api/query/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
          };
        }
      }
    );
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the tool is 'useful for' certain analyses but doesn't disclose critical behavioral traits: whether this is a read-only operation, what permissions are needed, whether it has rate limits, what format the returned data takes, or if there are pagination considerations. The description adds some context about use cases but lacks operational details.

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 earn their place by adding value. However, it could be slightly more front-loaded with the most critical operational information.

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 has 5 parameters, no annotations, and no output schema, the description is incomplete. It doesn't address what the tool returns, how results are structured, or important behavioral constraints. For a data retrieval tool with multiple parameters and no structured output documentation, the description should provide more complete 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 fully documents all 5 parameters. The description doesn't add any parameter-specific information beyond what's in the schema. It mentions 'profile' which relates to 'distinct_ids' but doesn't provide additional semantic context about parameter relationships or usage patterns.

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.' It specifies the resource (profile's event activity) and verb (get data). However, it doesn't explicitly differentiate from sibling tools like 'query_profiles' or 'aggregate_event_counts' that might also involve profile or event data.

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 individual user journeys, troubleshooting user-specific issues, and analyzing behavior patterns of specific users.' This suggests when to use it (for individual user analysis), but doesn't explicitly state when not to use it or name alternatives among the many sibling tools.

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