Skip to main content
Glama
mendeel
by mendeel

profile_event_activity

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

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 handler function that executes the tool's core logic: authenticates with Mixpanel service account, constructs the API URL for /stream/query endpoint with distinct_ids and date range, fetches profile event activity data, and returns JSON response or error.
    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 }; } }
  • Input schema defining parameters for the tool: project_id (optional), workspace_id (optional), distinct_ids (required JSON string array), from_date and to_date (required yyyy-mm-dd).
    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:346-375 (registration)
    Tool registration in ListToolsRequestSchema handler, including name, description, and inputSchema.
    { 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)
    Dispatch case in CallToolRequestSchema handler that routes calls to the handleProfileEventActivity function.
    case "profile_event_activity": return await handleProfileEventActivity(args, { SERVICE_ACCOUNT_USER_NAME, SERVICE_ACCOUNT_PASSWORD, DEFAULT_PROJECT_ID, MIXPANEL_BASE_URL });

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