Skip to main content
Glama
mendeel
by mendeel

list_saved_cohorts

Retrieve saved user cohorts from your Mixpanel project to identify existing segments and obtain cohort IDs for detailed analysis.

Instructions

List user cohorts in the project. Useful for discovering existing user segments and getting cohort IDs for analysis.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idNoThe Mixpanel project ID. Optional since it has a default.

Implementation Reference

  • The handler function that executes the list_saved_cohorts tool by calling Mixpanel API /cohorts/list endpoint to retrieve saved cohorts.
    async function handleListSavedCohorts(args: any, config: any) { const { project_id = config.DEFAULT_PROJECT_ID } = 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}/cohorts/list?project_id=${project_id}`; 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 listing saved cohorts:", error); const errorMessage = error instanceof Error ? error.message : String(error); return { content: [ { type: "text", text: `Error listing saved cohorts: ${errorMessage}` } ], isError: true }; }
  • The input schema and tool metadata definition for list_saved_cohorts in the ListTools response.
    { name: "list_saved_cohorts", description: "List user cohorts in the project. Useful for discovering existing user segments and getting cohort IDs for analysis.", inputSchema: { type: "object", properties: { project_id: { type: "string", description: "The Mixpanel project ID. Optional since it has a default." } } }
  • src/index.ts:635-636 (registration)
    The registration/dispatch case in the CallToolRequestSchema handler that routes to the handler function.
    case "list_saved_cohorts": return await handleListSavedCohorts(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