Skip to main content
Glama
mendeel
by mendeel

query_funnel_report

Analyze conversion rates through multi-step user flows to identify drop-off points and optimize user journey performance.

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
eventsYesJSON array string of events that make up the funnel steps
from_dateYesThe date in yyyy-mm-dd format to begin querying from (inclusive)
funnel_windowNoNumber of days users have to complete the funnel
intervalNoThe time interval for funnel analysis
project_idNoThe Mixpanel project ID. Optional since it has a default.
to_dateYesThe date in yyyy-mm-dd format to query to (inclusive)

Implementation Reference

  • The main handler function that executes the tool logic by constructing and sending a GET request to Mixpanel's /funnels API endpoint with authentication and parameters, then 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 }; } }
  • Input schema defining parameters for the query_funnel_report tool, including required fields from_date, to_date, events (as JSON string), and optional project_id, funnel_window, interval.
    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)
    Registration in the CallToolRequestSchema switch statement that dispatches calls to the handleQueryFunnelReport handler.
    case "query_funnel_report": return await handleQueryFunnelReport(args, { SERVICE_ACCOUNT_USER_NAME, SERVICE_ACCOUNT_PASSWORD, DEFAULT_PROJECT_ID, MIXPANEL_BASE_URL });
  • src/index.ts:450-484 (registration)
    Tool definition including name, description, and inputSchema registered in the ListToolsRequestSchema handler.
    { 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"] } },

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