Skip to main content
Glama
mendeel

Mixpanel MCP

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 });
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. While it mentions the tool's analytical purpose, it doesn't describe important behavioral traits: whether this is a read-only operation, what permissions might be required, potential rate limits, response format, or data freshness. For a query tool with 6 parameters, this leaves significant gaps in understanding how the tool behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately concise with two sentences that efficiently state the tool's purpose and utility. The first sentence establishes the core function, and the second explains its analytical value. There's no wasted text, though it could be slightly more structured with explicit usage guidance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a query tool with 6 parameters, no annotations, and no output schema, the description is insufficiently complete. It lacks critical context about behavioral traits (read-only status, permissions, rate limits), output format, and when to use versus sibling tools. While the schema covers parameters well, the description doesn't compensate for the missing annotations and output schema, leaving the agent with incomplete operational understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description provides no parameter-specific information beyond the tool's general purpose. However, with 100% schema description coverage, all 6 parameters are well-documented in the input schema with clear descriptions, enums for 'interval', and required fields. The description doesn't add value beyond the schema, but the schema provides adequate parameter documentation, meeting the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get funnel conversion data' with the specific goal of 'analyzing conversion rates through multi-step user flows and identifying drop-off points.' This provides a specific verb ('Get') and resource ('funnel conversion data') with clear analytical intent. However, it doesn't explicitly distinguish this from sibling tools like 'query_insights_report' or 'query_segmentation_report' which might also analyze user behavior.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides minimal usage guidance, stating only that it's 'Useful for analyzing conversion rates through multi-step user flows and identifying drop-off points.' This implies context but doesn't specify when to use this tool versus alternatives like 'query_insights_report' or 'query_segmentation_report' from the sibling list, nor does it mention prerequisites or exclusions. No explicit when/when-not guidance is provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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