Skip to main content
Glama
mendeel

Mixpanel MCP

by mendeel

query_insights_report

Retrieve pre-configured analytics reports and dashboards from Mixpanel to access saved insights with date filtering.

Instructions

Get saved insights reports. Useful for accessing pre-configured analytics reports and dashboards.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idNoThe Mixpanel project ID. Optional since it has a default.
report_idYesThe ID of the saved insights report to retrieve
from_dateNoThe date in yyyy-mm-dd format to begin querying from (inclusive)
to_dateNoThe date in yyyy-mm-dd format to query to (inclusive)

Implementation Reference

  • The handler function that implements the core logic for the 'query_insights_report' tool, making an authenticated GET request to Mixpanel's /insights endpoint and returning the JSON response.
    async function handleQueryInsightsReport(args: any, config: any) {
      const { 
        project_id = config.DEFAULT_PROJECT_ID, 
        report_id, 
        from_date, 
        to_date 
      } = args;
      
      try {
        const credentials = `${config.SERVICE_ACCOUNT_USER_NAME}:${config.SERVICE_ACCOUNT_PASSWORD}`;
        const encodedCredentials = Buffer.from(credentials).toString('base64');
        
        let url = `${config.MIXPANEL_BASE_URL}/insights?project_id=${project_id}&report_id=${report_id}`;
        
        if (from_date) {
          url += `&from_date=${from_date}`;
        }
        if (to_date) {
          url += `&to_date=${to_date}`;
        }
        
        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 insights report:", error);
        const errorMessage = error instanceof Error ? error.message : String(error);
        return {
          content: [
            {
              type: "text",
              text: `Error querying insights report: ${errorMessage}`
            }
          ],
          isError: true
        };
      }
    }
  • Input schema definition for the 'query_insights_report' tool, specifying parameters like report_id (required), project_id, from_date, and to_date.
    inputSchema: {
      type: "object",
      properties: {
        project_id: {
          type: "string",
          description: "The Mixpanel project ID. Optional since it has a default."
        },
        report_id: {
          type: "string",
          description: "The ID of the saved insights report to retrieve"
        },
        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)"
        }
      },
      required: ["report_id"]
    }
  • src/index.ts:570-595 (registration)
    Tool registration in the ListTools response, including name, description, and input schema for 'query_insights_report'.
    {
      name: "query_insights_report",
      description: "Get saved insights reports. Useful for accessing pre-configured analytics reports and dashboards.",
      inputSchema: {
        type: "object",
        properties: {
          project_id: {
            type: "string",
            description: "The Mixpanel project ID. Optional since it has a default."
          },
          report_id: {
            type: "string",
            description: "The ID of the saved insights report to retrieve"
          },
          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)"
          }
        },
        required: ["report_id"]
      }
    }
  • src/index.ts:645-646 (registration)
    Dispatch case in the CallToolRequestSchema handler that routes calls to the 'query_insights_report' handler function.
    case "query_insights_report":
      return await handleQueryInsightsReport(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 full burden for behavioral disclosure. It states this is a 'Get' operation but doesn't clarify if it's read-only, requires authentication, has rate limits, returns paginated results, or what format the output takes. The description adds minimal behavioral context beyond the basic action.

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

Conciseness5/5

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

The description is extremely concise with just two sentences that efficiently convey the core purpose. Every word earns its place, with no redundant information or unnecessary elaboration. It's appropriately sized for a tool with good schema documentation.

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 tool with 4 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what insights reports contain, what format they return in, whether date filtering is required, or how this differs from other query_* report tools. The minimal description leaves significant gaps in understanding the tool's behavior and output.

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?

Schema description coverage is 100%, so all parameters are documented in the schema. The description doesn't add any parameter-specific information beyond what's in the schema. It mentions 'saved insights reports' which aligns with the report_id parameter but provides no additional syntax, format, or usage details for parameters.

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 verb 'Get' and resource 'saved insights reports', with additional context about accessing 'pre-configured analytics reports and dashboards'. It distinguishes from siblings like query_funnel_report or query_segmentation_report by focusing on insights reports specifically, though it doesn't explicitly contrast them.

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 no guidance on when to use this tool versus alternatives like query_funnel_report or query_segmentation_report. It mentions 'useful for accessing pre-configured analytics reports' but gives no context about prerequisites, exclusions, or comparative use cases with sibling tools.

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