Skip to main content
Glama
mendeel

Mixpanel MCP

by mendeel

custom_jql

Execute custom JQL queries to perform advanced analytics and data analysis beyond standard Mixpanel reports.

Instructions

Run custom JQL (JSON Query Language) queries. Useful for advanced analytics and custom data analysis beyond standard reports.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idNoThe Mixpanel project ID. Optional since it has a default.
scriptYesThe JQL script to execute

Implementation Reference

  • The handler function that executes custom JQL queries against Mixpanel by sending a POST request to the /jql endpoint with the provided script.
    async function handleCustomJQL(args: any, config: any) {
      const { project_id = config.DEFAULT_PROJECT_ID, script } = args;
      
      try {
        const credentials = `${config.SERVICE_ACCOUNT_USER_NAME}:${config.SERVICE_ACCOUNT_PASSWORD}`;
        const encodedCredentials = Buffer.from(credentials).toString('base64');
        
        const options = {
          method: 'POST',
          headers: {
            'accept': 'application/json',
            'authorization': `Basic ${encodedCredentials}`,
            'content-type': 'application/json'
          },
          body: JSON.stringify({
            project_id: project_id,
            script: script
          })
        };
        
        const response = await fetch(`${config.MIXPANEL_BASE_URL}/jql`, 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 executing custom JQL:", error);
        const errorMessage = error instanceof Error ? error.message : String(error);
        return {
          content: [
            {
              type: "text",
              text: `Error executing custom JQL: ${errorMessage}`
            }
          ],
          isError: true
        };
      }
    }
  • Input schema defining parameters for the custom_jql tool: project_id (optional) and script (required).
    inputSchema: {
      type: "object",
      properties: {
        project_id: {
          type: "string",
          description: "The Mixpanel project ID. Optional since it has a default."
        },
        script: {
          type: "string",
          description: "The JQL script to execute"
        }
      },
      required: ["script"]
    }
  • src/index.ts:513-530 (registration)
    Registration of the custom_jql tool in the MCP tools list, including name, description, and input schema.
    {
      name: "custom_jql",
      description: "Run custom JQL (JSON Query Language) queries. Useful for advanced analytics and custom data analysis beyond standard reports.",
      inputSchema: {
        type: "object",
        properties: {
          project_id: {
            type: "string",
            description: "The Mixpanel project ID. Optional since it has a default."
          },
          script: {
            type: "string",
            description: "The JQL script to execute"
          }
        },
        required: ["script"]
      }
    },
  • src/index.ts:639-640 (registration)
    Dispatch case in the tool request handler that routes 'custom_jql' calls to the handleCustomJQL function.
    case "custom_jql":
      return await handleCustomJQL(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?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the tool runs queries for analytics, but doesn't disclose critical behavioral traits such as whether it's read-only or has side effects, authentication requirements, rate limits, error handling, or the format of results. For a query tool with no annotations, this is a significant gap in transparency.

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 appropriately sized and front-loaded: it starts with the core purpose ('Run custom JQL queries') and follows with a brief context sentence. Both sentences earn their place by clarifying the tool's role and use case, with zero wasted words or redundancy.

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?

Given the complexity of a custom query tool with no annotations, no output schema, and 2 parameters, the description is incomplete. It lacks details on behavioral aspects (e.g., safety, performance), result format, error conditions, and how it differs from sibling query tools. While the schema covers parameters, the overall context for an agent to use this tool effectively is insufficient.

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 doesn't add any parameter-specific information beyond what the input schema provides. Since schema description coverage is 100% (both parameters have descriptions in the schema), the baseline score is 3. The description doesn't compensate with additional details about parameter usage, syntax examples, or constraints, so it doesn't exceed the baseline.

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: 'Run custom JQL (JSON Query Language) queries.' It specifies the action ('run') and resource ('JQL queries'), and distinguishes it from 'standard reports' by mentioning 'advanced analytics and custom data analysis beyond standard reports.' However, it doesn't explicitly differentiate from all sibling tools like 'query_funnel_report' or 'query_insights_report' that also involve querying, so it doesn't reach a perfect score.

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

Usage Guidelines3/5

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

The description provides some usage context by stating it's 'useful for advanced analytics and custom data analysis beyond standard reports,' which implies when to use this tool (for complex queries not covered by standard reports). However, it doesn't explicitly mention when not to use it or name specific alternatives among the sibling tools (e.g., use 'query_insights_report' for predefined insights vs. this for custom JQL), leaving the guidance somewhat implied rather than explicit.

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