aggregated_event_property_values
Analyze event property value distributions in Mixpanel to understand user behavior patterns and identify common values across specified date ranges.
Instructions
Analyze specific event properties and their values. Useful for understanding property distributions and identifying common values.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | No | The Mixpanel project ID. Optional since it has a default. | |
| event | Yes | The event name to analyze properties for | |
| property | Yes | The property name to get values for | |
| from_date | Yes | The date in yyyy-mm-dd format to begin querying from (inclusive) | |
| to_date | Yes | The date in yyyy-mm-dd format to query to (inclusive) | |
| limit | No | Maximum number of property values to return |
Implementation Reference
- src/index.ts:869-916 (handler)The handler function that executes the tool: queries Mixpanel API endpoint /events/properties/values for the specified event and property values within date range, handles auth with Basic auth, returns JSON data or error.async function handleAggregatedEventPropertyValues(args: any, config: any) { const { project_id = config.DEFAULT_PROJECT_ID, event, property, from_date, to_date, limit = 100 } = args; try { const credentials = `${config.SERVICE_ACCOUNT_USER_NAME}:${config.SERVICE_ACCOUNT_PASSWORD}`; const encodedCredentials = Buffer.from(credentials).toString('base64'); const url = `${config.MIXPANEL_BASE_URL}/events/properties/values?project_id=${project_id}&event=${encodeURIComponent(event)}&name=${encodeURIComponent(property)}&from_date=${from_date}&to_date=${to_date}&limit=${limit}`; const options = { method: 'GET', headers: { 'accept': 'application/json', 'authorization': `Basic ${encodedCredentials}` } }; 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 event property values:", error); const errorMessage = error instanceof Error ? error.message : String(error); return { content: [ { type: "text", text: `Error fetching event property values: ${errorMessage}` } ], isError: true }; } }
- src/index.ts:314-341 (schema)Input schema defining parameters for the tool: project_id (opt), event, property, from_date, to_date (req), limit (opt). Used for validation.type: "object", properties: { project_id: { type: "string", description: "The Mixpanel project ID. Optional since it has a default." }, event: { type: "string", description: "The event name to analyze properties for" }, property: { type: "string", description: "The property name to get values for" }, 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)" }, limit: { type: "number", description: "Maximum number of property values to return" } }, required: ["event", "property", "from_date", "to_date"]
- src/index.ts:310-342 (registration)Tool registration in the tools list provided to server.setRequestHandler for ListToolsRequestSchema, including name, description, and inputSchema.{ name: "aggregated_event_property_values", description: "Analyze specific event properties and their values. Useful for understanding property distributions and identifying common values.", inputSchema: { type: "object", properties: { project_id: { type: "string", description: "The Mixpanel project ID. Optional since it has a default." }, event: { type: "string", description: "The event name to analyze properties for" }, property: { type: "string", description: "The property name to get values for" }, 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)" }, limit: { type: "number", description: "Maximum number of property values to return" } }, required: ["event", "property", "from_date", "to_date"] }
- src/index.ts:615-616 (registration)Dispatch case in the main tool call handler switch statement that routes calls to this tool to its handler function.case "aggregated_event_property_values": return await handleAggregatedEventPropertyValues(args, { SERVICE_ACCOUNT_USER_NAME, SERVICE_ACCOUNT_PASSWORD, DEFAULT_PROJECT_ID, MIXPANEL_BASE_URL });