Skip to main content
Glama

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 }; } } );

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