Skip to main content
Glama
mendeel
by mendeel

query_funnel_report

Analyze conversion rates through multi-step user flows and identify drop-off points in Mixpanel funnels using date ranges and event sequences.

Instructions

Get funnel conversion data. Useful for analyzing conversion rates through multi-step user flows and identifying drop-off points.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idNoThe Mixpanel project ID. Optional since it has a default.
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)
eventsYesJSON array string of events that make up the funnel steps
funnel_windowNoNumber of days users have to complete the funnel
intervalNoThe time interval for funnel analysis

Implementation Reference

  • The handler function that executes the tool logic by making a GET request to Mixpanel's /funnels API endpoint with authentication and parameters, returning the JSON response or error.
    async function handleQueryFunnelReport(args: any, config: any) { const { project_id = config.DEFAULT_PROJECT_ID, from_date, to_date, events, funnel_window = 14, interval = "day" } = 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}/funnels?project_id=${project_id}&from_date=${from_date}&to_date=${to_date}&events=${encodeURIComponent(events)}&funnel_window=${funnel_window}&interval=${interval}`; 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 querying funnel report:", error); const errorMessage = error instanceof Error ? error.message : String(error); return { content: [ { type: "text", text: `Error querying funnel report: ${errorMessage}` } ], isError: true }; } }
  • The tool definition including name, description, and inputSchema for validation in the MCP tools list.
    name: "query_funnel_report", description: "Get funnel conversion data. Useful for analyzing conversion rates through multi-step user flows and identifying drop-off points.", inputSchema: { type: "object", properties: { project_id: { type: "string", description: "The Mixpanel project ID. Optional since it has a default." }, 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)" }, events: { type: "string", description: "JSON array string of events that make up the funnel steps" }, funnel_window: { type: "number", description: "Number of days users have to complete the funnel" }, interval: { type: "string", enum: ["day", "week", "month"], description: "The time interval for funnel analysis" } }, required: ["from_date", "to_date", "events"] }
  • src/index.ts:629-630 (registration)
    The switch case in the tool request handler that dispatches to the handleQueryFunnelReport function.
    case "query_funnel_report": return await handleQueryFunnelReport(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