Skip to main content
Glama
mendeel
by mendeel

custom_jql

Execute custom JQL queries for advanced analytics and data analysis beyond standard Mixpanel reports, enabling tailored insights from event data.

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 main handler function that executes custom JQL queries by sending a POST request to Mixpanel's /jql endpoint with the provided script, authenticating with service account credentials, and returning the JSON response or error.
    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 }; } }
  • src/index.ts:513-530 (registration)
    Tool registration in the ListTools response, defining the name, description, and input schema for 'custom_jql'.
    { 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 registration in the CallToolRequestSchema switch statement that routes calls to the handleCustomJQL handler.
    case "custom_jql": return await handleCustomJQL(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