Skip to main content
Glama
mendeel
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 });

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