# How to integrate Gleap MCP with LlamaIndex

```json
{
  "title": "How to integrate Gleap MCP with LlamaIndex",
  "toolkit": "Gleap",
  "toolkit_slug": "gleap",
  "framework": "LlamaIndex",
  "framework_slug": "llama-index",
  "url": "https://composio.dev/toolkits/gleap/framework/llama-index",
  "markdown_url": "https://composio.dev/toolkits/gleap/framework/llama-index.md",
  "updated_at": "2026-05-12T10:13:15.438Z"
}
```

## Introduction

This guide walks you through connecting Gleap to LlamaIndex using the Composio tool router. By the end, you'll have a working Gleap agent that can archive resolved support tickets from last week, send a chat message to follow up on feedback, list all articles in the onboarding collection through natural language commands.
This guide will help you understand how to give your LlamaIndex agent real control over a Gleap account through Composio's Gleap MCP server.
Before we dive in, let's take a quick look at the key ideas and tools involved.

## Also integrate Gleap with

- [OpenAI Agents SDK](https://composio.dev/toolkits/gleap/framework/open-ai-agents-sdk)
- [Claude Agent SDK](https://composio.dev/toolkits/gleap/framework/claude-agents-sdk)
- [Claude Code](https://composio.dev/toolkits/gleap/framework/claude-code)
- [Claude Cowork](https://composio.dev/toolkits/gleap/framework/claude-cowork)
- [Codex](https://composio.dev/toolkits/gleap/framework/codex)
- [OpenClaw](https://composio.dev/toolkits/gleap/framework/openclaw)
- [Hermes](https://composio.dev/toolkits/gleap/framework/hermes-agent)
- [CLI](https://composio.dev/toolkits/gleap/framework/cli)
- [Google ADK](https://composio.dev/toolkits/gleap/framework/google-adk)
- [LangChain](https://composio.dev/toolkits/gleap/framework/langchain)
- [Vercel AI SDK](https://composio.dev/toolkits/gleap/framework/ai-sdk)
- [Mastra AI](https://composio.dev/toolkits/gleap/framework/mastra-ai)
- [CrewAI](https://composio.dev/toolkits/gleap/framework/crew-ai)

## TL;DR

Here's what you'll learn:
- Set your OpenAI and Composio API keys
- Install LlamaIndex and Composio packages
- Create a Composio Tool Router session for Gleap
- Connect LlamaIndex to the Gleap MCP server
- Build a Gleap-powered agent using LlamaIndex
- Interact with Gleap through natural language

## What is LlamaIndex?

LlamaIndex is a data framework for building LLM applications. It provides tools for connecting LLMs to external data sources and services through agents and tools.
Key features include:
- ReAct Agent: Reasoning and acting pattern for tool-using agents
- MCP Tools: Native support for Model Context Protocol
- Context Management: Maintain conversation context across interactions
- Async Support: Built for async/await patterns

## What is the Gleap MCP server, and what's possible with it?

The Gleap MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your Gleap account. It provides structured and secure access to your customer feedback data, so your agent can perform actions like managing support tickets, communicating with users, organizing help center content, and handling team workflows on your behalf.
- Ticket creation and management: Instantly create new support tickets, archive resolved issues, or retrieve existing tickets to streamline customer support workflows.
- Chat and user communication: Allow your agent to send new chat messages or fetch entire chat histories, making it easy to keep conversations going with users.
- Help center organization: Create collections or retrieve articles in your help center, enabling your agent to help manage and organize your knowledge base content efficiently.
- Team and user administration: Add new teams for ticket assignment or remove users from projects, so you can stay on top of team management tasks without lifting a finger.
- Checklist and engagement tracking: Fetch detailed checklists to monitor user engagement or onboarding progress, giving your agent context to provide personalized support.

## Supported Tools

| Tool slug | Name | Description |
|---|---|---|
| `GLEAP_ARCHIVE_ALL_TICKETS` | Archive All Tickets | Tool to archive all tickets matching specific type and status criteria. Use when you need to bulk archive multiple tickets at once based on their type and status. |
| `GLEAP_ARCHIVE_A_TICKET` | Archive a Ticket | Tool to archive a ticket. Use after confirming the ticket ID and that the ticket is resolved. Call when moving tickets to history. |
| `GLEAP_CLONE_ENGAGEMENT` | Clone Engagement | Tool to clone an existing engagement. Use when you need to duplicate an engagement with all its configuration. |
| `GLEAP_CREATE_A_COLLECTION` | Create a Collection | Tool to create a help center collection. Use when adding a new organizational grouping in your Help Center. |
| `GLEAP_CREATE_AI_CONTENT` | Create AI Content | Tool to create or update AI content in Gleap's knowledge base. Use when adding new documentation, help articles, or product information that AI assistants can reference. Supports text, file, and product content types with optional batch operations. |
| `GLEAP_CREATE_A_NEW_CHAT_MESSAGE` | Create a new chat message | Creates a new chat message in a Gleap chat session. Use this action to: - Send a message as a user or admin in an existing chat session - Reply to customer inquiries in the Gleap support system - Add messages to ongoing conversations The action requires a valid sessionId (obtained from get_all_sessions or get_all_chat_messages actions), a role ("user" or "admin"), and message content. Returns the created message with its ID, timestamps, and configuration details. |
| `GLEAP_CREATE_A_NEW_SESSION` | Create a new session | Create a new user session in Gleap and associate it with a project. Use this to track user activity, engagement metrics, and session data. Sessions can be created with minimal information and enriched later through identify_user or other API calls. |
| `GLEAP_CREATE_A_NEW_TEAM` | Create a new team | Tool to create a new team. Use when you have team details ready and want to assign tickets among members. |
| `GLEAP_CREATE_A_NEW_TICKET` | Create a new ticket | Create a new support ticket in Gleap with detailed information including title, description, type, priority, status, tags, and attachments. Supports custom metadata and sentiment tracking for comprehensive ticket management and customer feedback analysis. |
| `GLEAP_CREATE_ENGAGEMENT_BANNER` | Create Engagement Banner | Tool to create a new engagement banner in Gleap. Use when you want to add a banner for user engagement, announcements, or surveys. All fields are optional; the API will create a banner with default values if no fields are specified (default name: 'New survey', status: 'draft', format: 'widget', frequency: 'once'). |
| `GLEAP_CREATE_ENGAGEMENT_CHECKLIST` | Create Engagement Checklist | Tool to create a new engagement checklist. Use when you need to set up a step-by-step guide or task list for users. |
| `GLEAP_CREATE_ENGAGEMENT_COBROWSE` | Create Engagement Cobrowse | Tool to create a new cobrowse product tour. Use when you need to set up an interactive guided tour for users to follow. |
| `GLEAP_CREATE_ENGAGEMENT_EMAIL` | Create Engagement Email | Tool to create a new engagement email in Gleap. Use when you want to send emails for user engagement, announcements, or marketing campaigns. Requires name, subject, and body; other fields are optional with defaults (type: 'EMAIL', status: 'draft', format: 'widget', frequency: 'once', targetAudience: 'all'). |
| `GLEAP_CREATE_ENGAGEMENT_MODAL` | Create Engagement Modal | Tool to create a new engagement modal in Gleap. Use when you want to display a modal dialog for user engagement, onboarding, announcements, or feature introductions. |
| `GLEAP_CREATE_ENGAGEMENT_PRODUCT_TOUR` | Create Engagement Product Tour | Tool to create a new product tour in Gleap. Use when you want to create guided tours for onboarding, feature introductions, or step-by-step walkthroughs for users. |
| `GLEAP_CREATE_ENGAGEMENT_PUSH_NOTIFICATION` | Create Engagement Push Notification | Tool to create a new push notification in Gleap. Use when you want to send push notifications for user engagement, announcements, or alerts. All fields are optional; the API will create a notification with default values (name: 'New survey', type: 'PUSH', status: 'draft', sound: true, hidden: false, sent: false, format: 'widget', frequencyType: 'dynamic', frequency: 'once', frequencyDays: 0). |
| `GLEAP_CREATE_ENGAGEMENT_TOOLTIP` | Create Engagement Tooltip | Tool to create a new engagement tooltip in Gleap. Use when you want to add tooltips for user guidance, onboarding, or feature explanations. |
| `GLEAP_CREATE_FEEDBACK_ITEM` | Create feedback item | Tool to manually create a feedback item (bug) in a Gleap project. Use when you need to: - Create a new bug report programmatically - Add customer feedback to a specific project - Submit feature requests or issues via API Requires project ID, title, and description. Supports optional fields like type, priority, status, tags, and custom metadata for comprehensive feedback tracking. |
| `GLEAP_CREATE_HELPCENTER_REDIRECT` | Create Help Center Redirect | Tool to create a new redirect for help center URLs. Use when you need to redirect old or deprecated help articles to new URLs. Supports both exact URL matching and pattern-based matching for flexible redirect rules. |
| `GLEAP_CREATE_MESSAGE_TEMPLATE` | Create Message Template | Tool to create a new message template in Gleap. Use when creating pre-defined message templates for support conversations, automated responses, or quick replies. The template can include actions (buttons, links) and attachments, and can be shared publicly or restricted to specific users. |
| `GLEAP_CREATE_NEW_CONVERSATION` | Create new conversation with session | Create a new conversation with a session in Gleap. Use this action to initiate a conversation linked to a specific session ID within a project. |
| `GLEAP_CREATE_QA_SNIPPET` | Create QA Snippet | Tool to create a QA snippet (question-answer pair) in Gleap. Use when you need to add knowledge base content or FAQ entries to help AI assistants answer user questions. |
| `GLEAP_CREATE_TRACKER_TICKET` | Create Tracker Ticket | Tool to create a tracker ticket in Gleap. Use when you need to create a new tracker-based ticket for tracking features, bugs, or tasks. |
| `GLEAP_DELETE_AI_CONTENT` | Delete AI Content | Tool to delete AI content by content ID. Use when you need to remove specific AI content from the system. |
| `GLEAP_DELETE_AICONTENT_BATCH` | Delete AI Content Batch | Tool to delete all AI content by batchId. Use when you need to remove all AI-generated content associated with a specific batch identifier. |
| `GLEAP_DELETE_A_USER_FROM_A_PROJECT` | Delete a User from a Project | Removes a user (team member) from a Gleap project, revoking their access. Use this when you need to remove a team member's access to the project by their user ID. The user ID can be obtained from the 'Get All Users for a Project' action. Note: This removes organization members from the project, not end-user sessions/contacts. |
| `GLEAP_DELETE_BUGS` | Delete Bugs | Tool to delete a bug/ticket by ID. Use when you need to permanently remove a bug from the system. |
| `GLEAP_DELETE_ENGAGEMENT_BANNER` | Delete Engagement Banner | Tool to delete an engagement banner. Use when you need to remove a banner from the project by its banner ID. |
| `GLEAP_DELETE_ENGAGEMENT_CHAT_MESSAGE` | Delete Engagement Chat Message | Deletes an engagement chat message from Gleap by its ID. Use this action to permanently remove a chat message from a conversation. The message ID must be obtained from a prior list or get operation. Once deleted, the message cannot be recovered. |
| `GLEAP_DELETE_ENGAGEMENT_CHECKLIST` | Delete Engagement Checklist | Tool to delete an engagement checklist by its ID. Use when removing a checklist from the project. |
| `GLEAP_DELETE_ENGAGEMENT_COBROWSE` | Delete Engagement Cobrowse | Tool to delete a cobrowse product tour by its ID. Use when you need to remove a cobrowse product tour from the project. |
| `GLEAP_DELETE_ENGAGEMENT_EMAIL` | Delete Engagement Email | Tool to delete an engagement email by its ID. Use when you need to remove an email from the project's engagement emails list. |
| `GLEAP_DELETE_ENGAGEMENT_MODAL` | Delete Engagement Modal | Tool to delete an engagement modal from a Gleap project. Use when you need to remove a modal by its ID. |
| `GLEAP_DELETE_ENGAGEMENT_NEWS` | Delete Engagement News | Tool to delete an engagement news article. Use when you need to remove a news article from the project by its news ID. |
| `GLEAP_DELETE_ENGAGEMENT_PRODUCT_TOUR` | Delete Engagement Product Tour | Tool to delete an engagement product tour by its ID. Use when you need to remove a product tour from the project's engagement product tours list. |
| `GLEAP_DELETE_ENGAGEMENT_PUSH_NOTIFICATION` | Delete Engagement Push Notification | Tool to delete an engagement push notification by its ID. Use when you need to remove a push notification from the project's engagement push notifications list. |
| `GLEAP_DELETE_ENGAGEMENT_SURVEYS` | Delete Engagement Surveys | Tool to delete an engagement survey. Use when you need to remove a survey from the project by its survey ID. |
| `GLEAP_DELETE_ENGAGEMENT_TOOLTIPS` | Delete Engagement Tooltips | Tool to delete an engagement tooltip. Use when you need to remove a tooltip from the project by its tooltip ID. |
| `GLEAP_DELETE_ENGAGEMENT_WHATSAPP_MESSAGE` | Delete Engagement WhatsApp Message | Tool to delete an engagement WhatsApp message by its ID. Use when you need to remove a WhatsApp message from the project's engagement WhatsApp messages list. |
| `GLEAP_DELETE_HELPCENTER_COLLECTION` | Delete Help Center Collection | Tool to delete a help center collection by ID. Use when you need to permanently remove a collection from the help center. |
| `GLEAP_DELETE_HELPCENTER_REDIRECT` | Delete Help Center Redirect | Tool to delete a help center redirect. Use when you need to remove a redirect from the help center by its redirect ID. |
| `GLEAP_DELETE_MESSAGE` | Delete Message | Tool to delete a message (comment) from a bug or ticket. Use when you need to permanently remove a comment from a bug/ticket conversation. |
| `GLEAP_DELETE_MESSAGE_TEMPLATE` | Delete Message Template | Tool to delete a message template. Use when you need to remove a message template from the project by its template ID. |
| `GLEAP_DELETE_OLD_AI_CONTENT_BATCHES` | Delete Old AI Content Batches | Delete all AI content batches except the current batch. Use when cleaning up old AI content and keeping only the latest batch by providing its ID. |
| `GLEAP_DELETE_PROJECTS_QAANSWERS` | Delete QA Answer | Tool to delete a QA answer (snippet) from a Gleap project. Use when removing help center content or AI assistant snippets. |
| `GLEAP_DELETE_PROJECTS_SESSIONS` | Delete project session | Tool to delete a session from a Gleap project. Use when you need to remove session data by providing both project ID and session ID. |
| `GLEAP_DELETE_SESSIONS` | Delete session | Tool to delete a session by ID. Use when you need to remove a specific session from the system. |
| `GLEAP_DELETE_TEAM` | Delete Team | Tool to delete a team by ID. Use when you need to permanently remove a team from the project. |
| `GLEAP_DELETE_TICKET` | Delete Ticket | Tool to delete a ticket by ID. Use when you need to permanently remove a ticket from the system. |
| `GLEAP_EXPORT_SESSIONS` | Export sessions | Tool to export sessions for the authenticated project in CSV format. Use when you need to export session data for analysis, reporting, or backup purposes. Returns comprehensive session information in CSV format including user details, activity data, and metadata. Use limit and skip parameters to control pagination for large datasets. |
| `GLEAP_EXPORT_STATISTICS_LISTS` | Export Statistics Lists | Tool to export statistics list data as CSV from Gleap. Use when you need to export performance metrics, analytics, or reports. Supports various report types including team performance, article statistics, ticket ratings, SLA reports, and more. Results can be filtered by date range, grouped by time intervals, and paginated for large datasets. |
| `GLEAP_GENERATE_TICKET_DRAFT_REPLY` | Generate ticket draft reply | Tool to generate an AI-powered draft reply for a ticket. Use when you need to automatically create a contextual response based on the ticket content, similar tickets, and knowledge base articles. The AI analyzes the ticket and suggests an appropriate reply that can be reviewed and sent. |
| `GLEAP_GENERATE_TRACKER_TICKET_DATA` | Generate tracker ticket data | Tool to generate AI-powered tracker ticket data from an existing ticket. Use when you need to automatically create a title and description for a tracker ticket based on a source ticket's content. The AI analyzes the source ticket and generates appropriate metadata. |
| `GLEAP_GET_A_CHECKLIST_ACTION` | Get a Checklist | Tool to retrieve a specific engagement checklist by its ID. Use after obtaining a valid checklistId. |
| `GLEAP_GET_A_COLLECTION` | Get a Collection | Tool to retrieve a help center collection by ID. Use when you need to fetch specific collection details by its ID. |
| `GLEAP_GET_AI_CONTENT` | Get AI content | Tool to retrieve AI content by its content ID. Use when you need to fetch specific AI-generated or AI-managed content from Gleap's AI content system. |
| `GLEAP_GET_ALL_ARTICLES` | Get all articles | Tool to retrieve articles in a help center collection. Use when you have a helpcenterCollectionId and want to list its articles. Supports pagination via limit and skip parameters. |
| `GLEAP_GET_ALL_CHAT_MESSAGES` | Get all chat messages | Retrieves all engagement chat messages from the current Gleap project. Use this action to: - List all chat conversations across all sessions - Review customer support interactions and message history - Analyze chat engagement data and message patterns - Export or audit chat communications Returns messages sorted by creation date (newest first) with complete metadata including sender information, session details, content, and timestamps. Supports pagination via limit and skip parameters. |
| `GLEAP_GET_ALL_COLLECTIONS` | Get All Collections | Retrieves all help center collections for the authenticated project. Collections are organizational containers in the help center that group related articles. Each collection can contain articles and nested sub-collections. Use this action to: - Get an overview of all collections in the help center - Check collection counts (articles and sub-collections) - Access collection metadata (titles, descriptions, audience filters) Returns an empty list if no collections exist in the project. |
| `GLEAP_GET_ALL_INVITATIONS_FOR_A_PROJECT` | Get All Invitations for a Project | Retrieves all pending invitations for a project. Use this to list users who have been invited to join the project but haven't accepted yet. The project context is automatically determined from the authentication headers. |
| `GLEAP_GET_ALL_SESSIONS` | Get all sessions | Retrieves all user sessions for the authenticated project. This endpoint returns comprehensive session data including user information, activity timestamps, engagement metrics, and metadata for all sessions associated with the project. Useful for analytics, user tracking, and session management. Use limit and skip parameters to control pagination for large datasets. |
| `GLEAP_GET_ALL_TEAMS` | Get All Teams | Tool to retrieve all teams. Use when you need a list of all teams for the authenticated project. |
| `GLEAP_GET_ALL_TICKETS` | Get All Tickets | Retrieve tickets from a Gleap project with optional filtering, sorting, and pagination. This action fetches tickets from the authenticated Gleap project. Without parameters, it returns all tickets. Use filters to narrow results by type, status, priority, or spam classification. Results can be sorted and paginated for efficient data retrieval. Use cases: - List all open bugs: Set status='OPEN' and type='BUG' - Get recent tickets: Set sort='-createdAt' and limit=20 - Paginate through tickets: Use skip and limit parameters - Find high-priority issues: Set priority='HIGH' |
| `GLEAP_GET_ALL_USERS_FOR_A_PROJECT` | Get All Users for a Project | Tool to retrieve all users for a project. Use when you need to list every user associated with the current project. |
| `GLEAP_GET_A_TICKET` | Get a ticket | Retrieves complete details for a specific ticket by its ID. Use this action when you need to: - View full ticket information including title, description, status, and priority - Check ticket metadata like creation time, tags, and custom data - Access associated session and user information - Review AI-generated summaries and support recommendations Returns comprehensive ticket data including type (BUG/FEATURE_REQUEST), priority level, sentiment analysis, upvotes, linked tickets, and custom fields. |
| `GLEAP_GET_CURRENT_USER` | Get current user | Retrieves the authenticated user's profile including email, name, user type, availability status, notification preferences, and 2FA settings. No parameters required - uses authentication from headers. Returns detailed user information including notification preferences for different event types (tickets, assignments, mentions) and account settings. |
| `GLEAP_GET_ENGAGEMENT_ACTIVITIES_COUNT` | Get engagement activities count | Tool to retrieve the count of activities for a specific engagement. Use when you need to know how many activities are associated with an engagement without fetching all activity details. |
| `GLEAP_GET_ENGAGEMENT_BANNER` | Get engagement banner | Tool to retrieve an engagement banner by its ID. Use when you need to fetch specific banner details including title, message, button configuration, targeting settings, and display schedule. |
| `GLEAP_GET_ENGAGEMENT_BANNERS` | Get Engagement Banners | Tool to retrieve all engagement banners from a Gleap project. Use when you need to list all banners for viewing, auditing, or selecting a specific banner for further operations. |
| `GLEAP_GET_ENGAGEMENT_CHAT_MESSAGE` | Get engagement chat message | Retrieves a specific engagement chat message by its ID. Use this action to fetch complete details of a single chat message including content, sender role, timestamps, and configuration settings. |
| `GLEAP_GET_ENGAGEMENT_CHECKLISTS` | Get Engagement Checklists | Tool to retrieve all engagement checklists for a project. Use when you need to get an overview of all available checklists. |
| `GLEAP_GET_ENGAGEMENT_COBROWSE` | Get Engagement Cobrowse | Retrieves all cobrowse product tours for the authenticated project. Cobrowse product tours are interactive guided experiences that help users navigate through features or workflows. Use this action to get an overview of all configured cobrowse tours in your project, including their status, steps, and settings. |
| `GLEAP_GET_ENGAGEMENT_COBROWSE_BY_ID` | Get engagement cobrowse by ID | Tool to retrieve a specific cobrowse product tour by its ID. Use when you need to fetch complete details of a single cobrowse tour including steps, settings, status, and configuration. |
| `GLEAP_GET_ENGAGEMENT_EMAIL` | Get engagement email | Retrieves a specific engagement email by its ID. Use this action to fetch complete details of a single engagement email including name, subject, body content, status, and configuration settings like frequency, target audience, and scheduling. |
| `GLEAP_GET_ENGAGEMENT_EMAILS` | Get Engagement Emails | Tool to retrieve all engagement emails from a Gleap project. Use when you need to list all emails for viewing, auditing, or selecting a specific email for further operations. |
| `GLEAP_GET_ENGAGEMENT_MODAL` | Get engagement modal | Tool to retrieve an engagement modal by its ID. Use when you need to fetch specific modal details including title, message, button configuration, targeting settings, and display schedule. |
| `GLEAP_GET_ENGAGEMENT_MODALS` | Get Engagement Modals | Tool to retrieve all engagement modals from a Gleap project. Use when you need to list all modals for viewing, auditing, or selecting a specific modal for further operations. |
| `GLEAP_GET_ENGAGEMENT_NEWS` | Get Engagement News | Tool to retrieve all engagement news articles from a Gleap project. Use when you need to list all news articles for viewing, auditing, or selecting a specific article for further operations. |
| `GLEAP_GET_ENGAGEMENT_NEWS_ARTICLE` | Get engagement news article | Retrieves a specific engagement news article by its ID. Use this action to fetch complete details of a single news article including content, configuration, targeting settings, and delivery schedule. |
| `GLEAP_GET_ENGAGEMENT_PRODUCT_TOUR` | Get a Product Tour | Tool to retrieve a specific engagement product tour by its ID. Use after obtaining a valid productTourId to fetch detailed tour configuration including steps, targeting, and timing settings. |
| `GLEAP_GET_ENGAGEMENT_PRODUCT_TOURS` | Get Engagement Product Tours | Tool to retrieve all engagement product tours for a project. Use when you need to get an overview of all available product tours. |
| `GLEAP_GET_ENGAGEMENT_PUSH_NOTIFICATION` | Get engagement push notification | Retrieves a specific engagement push notification by its ID. Use this action to fetch complete details of a single push notification including name, title, message content, status, and configuration settings like frequency, target audience, and scheduling. |
| `GLEAP_GET_ENGAGEMENT_PUSH_NOTIFICATIONS` | Get Engagement Push Notifications | Tool to retrieve all engagement push notifications from a Gleap project. Use when you need to list all push notifications for viewing, auditing, or selecting a specific push notification for further operations. |
| `GLEAP_GET_ENGAGEMENTS_ACTIVITIES` | Get Engagements Activities | Tool to retrieve all activities for a specific engagement. Use when you need to track user interactions, view engagement performance, or analyze activity patterns for a particular engagement campaign. |
| `GLEAP_GET_ENGAGEMENTS_RECIPIENTS` | Get engagement recipients | Tool to find and retrieve recipients for a specific engagement. Use when you need to: - View all recipients who received an engagement (email, push notification, etc.) - Check delivery status and engagement metrics for recipients - Track when recipients opened or clicked on engagement content |
| `GLEAP_GET_ENGAGEMENTS_STATISTICS` | Get engagement statistics | Tool to retrieve statistics for a specific engagement. Use when you need to analyze engagement performance metrics such as views, interactions, conversions, and user behavior data. |
| `GLEAP_GET_ENGAGEMENT_SURVEY` | Get Engagement Survey | Tool to retrieve a survey by its ID. Use when you need to view survey details including name, description, status, format, questions, and other configuration settings. |
| `GLEAP_GET_ENGAGEMENT_SURVEYS` | Get Engagement Surveys | Tool to retrieve all engagement surveys from a Gleap project. Use when you need to list all surveys for viewing, auditing, or selecting a specific survey for further operations. |
| `GLEAP_GET_ENGAGEMENT_SURVEYS_RESPONSES` | Get Survey Responses | Tool to retrieve all survey responses for a specific survey. Use when you need to get all responses submitted for a survey. |
| `GLEAP_GET_ENGAGEMENT_SURVEYS_RESPONSES_SAMPLES` | Get Engagement Survey Response Samples | Tool to retrieve survey response samples for a specific engagement survey. Use when you need to view example responses, analyze survey feedback patterns, or audit survey submissions for a particular survey. |
| `GLEAP_GET_ENGAGEMENT_SURVEYS_RESPONSES_SUMMARIZE` | Summarize Survey Responses | Tool to retrieve an AI-generated summary of survey responses. Use when you need to analyze survey feedback, understand response patterns, or get insights from customer feedback without reviewing individual responses. |
| `GLEAP_GET_ENGAGEMENT_TOOLTIP_BY_ID` | Get Engagement Tooltip by ID | Tool to retrieve a specific engagement tooltip by its ID. Use when you need to get detailed information about a specific tooltip. |
| `GLEAP_GET_ENGAGEMENT_TOOLTIPS` | Get Engagement Tooltips | Tool to retrieve all engagement tooltips for the authenticated project. Use when you need to get a list of all configured tooltips. |
| `GLEAP_GET_ENGAGEMENT_WHATSAPP_MESSAGE` | Get engagement WhatsApp message | Retrieves a specific engagement WhatsApp message by its ID. Use this action to fetch complete details of a single WhatsApp message including content, status, and configuration settings like frequency, target audience, and scheduling. |
| `GLEAP_GET_HELP_CENTER_SOURCES` | Get Help Center Sources | Retrieves all configured help center sources (knowledge base content sources) for the project. Returns a list of sources with their IDs, titles, URLs, and metadata. Use this to discover available help center content sources before querying articles or answering questions. |
| `GLEAP_GET_INVITATIONS` | Get Invitations | Retrieves all invitations for the authenticated user. Use this to list all pending invitations (both organisation and project invitations) associated with the current user. The user context is automatically determined from the authentication headers. |
| `GLEAP_GET_MESSAGE_TEMPLATE` | Get message template | Retrieves a specific message template by its ID from a Gleap project. Use this when you need to fetch the details of a particular message template including its title, content, visibility settings, and associated metadata. |
| `GLEAP_GET_MESSAGE_TEMPLATES` | Get Message Templates | Retrieve all message templates for the authenticated project. Use when you need to list available message templates for customer communication. Message templates are pre-defined message formats that can be used for consistent communication with users. This action supports optional filtering via search term and pagination with a limit parameter. |
| `GLEAP_GET_NOTIFICATION_TICKET` | Get notification ticket | Retrieves detailed information about a Gleap ticket using its notification share token. Use this action to access public ticket details via a share token, which is typically obtained from ticket notifications or webhooks. This allows viewing ticket information without requiring full authentication. Returns comprehensive ticket data including title, description, status, priority, tags, and session information. |
| `GLEAP_GET_PROJECT` | Get project | Retrieves complete details for a specific project by its ID. Use when you need to view project configuration, settings, notification preferences, or metadata for a single project. |
| `GLEAP_GET_PROJECTS` | Get Projects | Retrieves all projects accessible to the authenticated user. Use when you need to list all projects the user has access to. Rate limit: 1000 requests per minute. |
| `GLEAP_GET_PROJECTS_BUGS_ARCHIVE` | Get archived bugs | Tool to retrieve archived bugs for a specific project. Use when you need to view bugs that have been archived or moved to history for a given project. |
| `GLEAP_GET_PROJECTS_HELPCENTER_COLLECTIONS` | Get Projects Help Center Collections | Tool to get all help center collections for a project. Use when you need to retrieve the complete list of help center collections including their metadata, titles, descriptions, and audience targeting settings. |
| `GLEAP_GET_PROJECTS_SESSIONS` | Get project sessions | Tool to retrieve all sessions for a specific project. Use when you need to get session data for a particular project by its ID. Returns comprehensive session information including user details, activity timestamps, and metadata. |
| `GLEAP_GET_PROJECTS_TICKETS` | Get Projects Tickets | Tool to retrieve all tickets from a specific Gleap project. Use when you need to get tickets for a particular project by its ID. |
| `GLEAP_GET_PROJECTS_USERS` | Get project users | Tool to get project users by project ID. Use when you need to list all users associated with a specific project. |
| `GLEAP_GET_SESSION` | Get a session | Retrieves detailed information for a specific session by its ID. Use this when you need to fetch comprehensive session data including user information, activity timestamps, engagement metrics, and custom metadata for a particular session. |
| `GLEAP_GET_SESSION_ACTIVITIES` | Get session activities | Retrieves all activities for a specific session by session ID. Use this action when you need to fetch detailed activity data for a particular session, including user interactions and session events. |
| `GLEAP_GET_SESSION_CHARGEBEE_INFO` | Get session Chargebee info | Tool to retrieve Chargebee billing information for a specific session. Use when you need to fetch subscription, payment, or billing details associated with a user session from Chargebee. |
| `GLEAP_GET_SESSION_CHECKLISTS` | Get Session Checklists | Retrieve all engagement checklists associated with a user session in Gleap. Engagement checklists help track user progress through onboarding flows, feature adoption, or guided workflows. Use this after obtaining a valid session ID (e.g., from Get All Sessions). Returns an empty list if the session has no associated checklists. |
| `GLEAP_GET_SESSION_EVENTS` | Get session events by ID | Tool to retrieve all streamed events for a specific session by its ID. Use when you need to get detailed event stream data for debugging user behavior or analyzing session activity. |
| `GLEAP_GET_SESSION_LEMON_SQUEEZY_INFO` | Get session LemonSqueezy info | Tool to retrieve LemonSqueezy subscription and payment information for a specific session. Use when you need to fetch LemonSqueezy data associated with a user session. |
| `GLEAP_GET_SESSION_SHOPIFY_INFO` | Get Session Shopify Info | Retrieve Shopify information associated with a user session in Gleap. Use this when you need to access e-commerce data from Shopify linked to a specific session. |
| `GLEAP_GET_SHARED_HELPCENTER_ANSWER` | Get Shared Help Center Answer | Retrieves an answer to a question from the shared help center knowledge base. Use this when you need to find information from help center articles based on a user's question. The endpoint searches through configured help center sources and returns the most relevant answer. Returns null if no matching answer is found. |
| `GLEAP_GET_STATISTICS_EMAIL_CLIENT_BOUNCES` | Get email client bounce statistics | Tool to retrieve email client bounce statistics from Gleap. Use when you need to analyze email delivery failures and bounce rates over time. The statistics can be filtered by date range, grouped by time intervals (day, month, year), and filtered by specific email server configurations. |
| `GLEAP_GET_STATISTICS_EMAIL_CLIENT_USAGE` | Get Email Client Usage Statistics | Tool to retrieve email client usage statistics from Gleap. Returns metrics such as sent emails, bounces, spam reports, and open rates. Use when you need to analyze email delivery performance, track email engagement, or monitor email client behavior over time. Note: The API typically requires startDate and endDate parameters to function properly. |
| `GLEAP_GET_STATISTICS_EMAIL_OVERVIEW` | Get email overview statistics | Tool to retrieve email overview statistics from Gleap. Use when you need to analyze email campaign performance metrics such as sent, delivered, opened, clicked, bounced emails, and engagement rates over a specified time period. |
| `GLEAP_GET_STATISTICS_FACTS` | Get statistics facts | Tool to retrieve fact data for various statistics from Gleap. Use when you need statistical insights about tickets, AI interactions, help center engagement, or SLA performance for a specific time period. |
| `GLEAP_GET_STATISTICS_HEATMAP` | Get Statistics Heatmap | Retrieve heatmap data for activity patterns in Gleap. Use when you need to visualize busiest hours per weekday or comment activity patterns. Returns aggregated data showing activity distribution across time dimensions, helpful for identifying peak usage times and activity trends. |
| `GLEAP_GET_STATISTICS_LISTS` | Get Statistics Lists | Tool to retrieve statistics list data from Gleap. Use when you need to access performance metrics, analytics, or reports. Supports various report types including team performance, article statistics, ticket ratings, SLA reports, and more. Results can be filtered by date range, grouped by time intervals, and paginated for large datasets. |
| `GLEAP_GET_STATISTICS_RAW_DATA` | Get Statistics Raw Data | Tool to retrieve raw statistics data from Gleap. Use when you need unprocessed, granular statistical data for custom analysis or reporting. |
| `GLEAP_GET_TICKETS_BY_SESSION_QUERY` | Get Tickets By Session Query | Find tickets by session query parameters such as email, userId, phone, or custom data. Use this when you need to retrieve tickets associated with a specific user session or contact information. |
| `GLEAP_GET_TICKETS_EXPORT` | Get Tickets Export | Export tickets from Gleap project with optional filtering and sorting. This action retrieves tickets in an export format suitable for data analysis, reporting, or backup purposes. Use filters to narrow the export to specific ticket types, statuses, or priorities. The project is automatically identified from authentication headers. |
| `GLEAP_GET_TICKETS_EXPORT_FIELDS` | Get Tickets Export Fields | Retrieve available fields for ticket export from Gleap. This action fetches metadata about which fields can be exported for tickets, useful for understanding what data is available before performing a ticket export. |
| `GLEAP_GET_TICKETS_SEARCH` | Search Tickets by Term | Search for tickets using a text search term in Gleap. Use when you need to find tickets based on keywords or phrases in titles and descriptions. |
| `GLEAP_GET_TICKETS_TICKETSCOUNT` | Get Tickets Count | Tool to get the total count of tickets in a Gleap project. Use when you need to know how many tickets exist without retrieving full ticket details. |
| `GLEAP_GET_USERS_ME_PERMISSIONS` | Get current user's permissions | Tool to retrieve the current user's role permissions. Use when you need to check what permissions the authenticated user has. |
| `GLEAP_GET_USERS_UNIFIED_INBOX` | Get users unified inbox | Retrieves tickets from the unified inbox for the authenticated user. Use this action to view all tickets assigned to or accessible by the current user across projects. Supports filtering by ticket type, project ID, and pagination for large result sets. |
| `GLEAP_GET_USERS_UNIFIED_INBOX_TICKET` | Get users unified inbox ticket | Retrieves complete details for a specific ticket from the unified inbox by its ID. Use this action when you need to: - View full unified inbox ticket information including title, description, status, and priority - Check ticket metadata like creation time, tags, and custom data - Access associated session and user information - Review notification status and agent replies - Get AI-generated summaries and support recommendations The unified inbox provides a consolidated view of tickets across different channels. Returns comprehensive ticket data including type, priority level, sentiment analysis, upvotes, linked tickets, and custom fields. |
| `GLEAP_IDENTIFY_USER` | Identify or update user | Identify or update a user's information in Gleap. Creates a new user if the userId doesn't exist, or updates the existing user's profile data. Use this to sync user information from your application to Gleap for customer support and feedback tracking. |
| `GLEAP_IMPORT_SESSION` | Import session | Import user sessions into Gleap for tracking and analytics. Use this action to: - Bulk import user session data from external systems - Migrate user data from other platforms into Gleap - Synchronize user information with Gleap's session tracking - Create or update user profiles with associated metadata Each session must include a userId, and can optionally include email, name, phone, avatar, language, company information, custom data, plan, value, and tags. |
| `GLEAP_IMPORT_SESSIONS_FROM_INTERCOM` | Import sessions from Intercom | Import user sessions from Intercom into Gleap. Use this to synchronize contact data and session information from your Intercom workspace to Gleap for unified customer support tracking. |
| `GLEAP_INDICATE_USER_TYPING` | Indicate user typing | Tool to indicate that a user is typing in a ticket conversation. Use this to show real-time typing indicators to other users viewing the same ticket. Set typing to true when starting to type and false when finished. |
| `GLEAP_INDICATE_USER_VIEWING` | Indicate user viewing | Tool to indicate that a user is viewing a ticket. Use this to show real-time viewing indicators to other users accessing the same ticket. Set viewing to true when starting to view and false when finished. |
| `GLEAP_LINK_A_TICKET` | Link a Ticket | Tool to link a ticket. Use when you need to connect two existing tickets after confirming both IDs exist. Example: Link a duplicate issue ticket to its original. |
| `GLEAP_MARK_SURVEY_RESPONSES_READ` | Mark Survey Responses as Read | Tool to mark all survey responses as read for a given survey. Use when you need to bulk-mark survey responses as read to clear unread indicators. |
| `GLEAP_MERGE_TICKETS` | Merge tickets | Tool to merge multiple tickets into a single target ticket in Gleap. Use when you need to consolidate duplicate tickets or combine related tickets into one. You can either merge into an existing ticket by providing targetTicketId, or create a new ticket by setting shouldCreateNewTicket to true. Optionally merge contacts and tasks from all tickets. |
| `GLEAP_POST_BUGS_COMMENTS` | Post a comment on a bug | Tool to post a comment/message on a bug or ticket in Gleap. Use when you need to add a comment to an existing bug/ticket conversation, such as providing updates, asking questions, or documenting resolution steps. |
| `GLEAP_POST_ENGAGEMENT_NEWS` | Create Engagement News Article | Tool to create a new engagement news article in Gleap. Use when you need to publish announcements, product updates, or news content to users. Configure scheduling, targeting, and display frequency. |
| `GLEAP_POST_ENGAGEMENT_SURVEYS` | Create Engagement Survey | Tool to create a new survey in Gleap. Use when you want to create a customer feedback survey, product satisfaction survey, or any user engagement survey. Only the name field is required; all other fields are auto-populated with defaults (status='draft', type='SURVEY', format='widget', frequency='once'). |
| `GLEAP_POST_ENGAGEMENT_WHATSAPP_MESSAGES` | Create WhatsApp Engagement Message | Tool to create a new WhatsApp message in Gleap for user engagement. Use when you want to send WhatsApp messages for customer support, announcements, or marketing campaigns. All fields are optional; the API will create a message with default values (name: 'New whatsapp message', type: 'WHATSAPP', status: 'draft', sound: true, hidden: false, sent: false, format: 'widget', frequencyType: 'dynamic', frequency: 'once', frequencyDays: 0). |
| `GLEAP_REASSIGN_ALL_TICKETS_TO_USER` | Reassign all tickets to user | Tool to reassign all tickets to the authenticated user. Use when you need to bulk reassign tickets to yourself for handling or review. |
| `GLEAP_RESUBSCRIBE_A_SESSION` | Resubscribe a Session | Tool to resubscribe a session. Use when you need to re-enable notifications or tracking for a previously unsubscribed session. |
| `GLEAP_SEARCH_FOR_SESSIONS` | Search for sessions | Search for sessions in Gleap using various filter criteria. Use when you need to find sessions by user ID, email, name, or other session attributes. Supports filtering by multiple criteria including user information (userId, email, name), session identifiers (gleapId, gleapHash), language, and user status (blocked, unsubscribed). |
| `GLEAP_SEARCH_MESSAGES` | Search messages | Search messages in Gleap by search term. Use when you need to find specific messages based on content, keywords, or metadata across all conversations and tickets. |
| `GLEAP_SEARCH_SESSIONS_BY_INDEX` | Search sessions by index | Search for sessions in a project using the session search index. Use when you need to retrieve sessions for a specific project using the indexed search endpoint. This endpoint provides indexed session data including user information, activity timestamps, engagement metrics, and metadata for sessions within a specific project. The search is optimized through Gleap's session index for faster lookups. |
| `GLEAP_SEND_ENGAGEMENT_EMAIL_PREVIEW` | Send Engagement Email Preview | Tool to send a preview of an engagement email to specified email addresses. Use when you need to test or review how an engagement email will appear before sending it to the actual recipients. |
| `GLEAP_SEND_TICKET_TRANSCRIPT` | Send ticket transcript | Tool to send ticket conversation transcript to multiple email addresses. Use when you need to share the complete conversation history of a ticket with external users or team members via email. |
| `GLEAP_SNOOZE_A_TICKET` | Snooze a Ticket | Tool to snooze a ticket for a specified duration. Use when you need to temporarily hide a ticket from active view. The ticket will be automatically unsnoozed after the duration expires. |
| `GLEAP_SUGGEST_FAQ_FROM_MESSAGE` | Suggest FAQ from message | Tool to suggest a FAQ from a message. Use when you want to accept or reject a FAQ suggestion for a specific message. |
| `GLEAP_TOGGLE_HELPCENTER_COLLECTION_PUBLISH` | Toggle Collection Publish Status | Tool to toggle the publish status of a help center collection. Use when you need to publish or unpublish a collection to control its visibility in the help center. |
| `GLEAP_TRACK_EVENTS` | Track events | Track custom user events in Gleap for analytics and user behavior monitoring. Use this action to: - Record user actions like button clicks, page views, feature usage - Log business events like purchases, subscriptions, or conversions - Send batch events for efficiency (supports multiple events per request) - Track events with custom metadata for detailed analytics Note: Users must be identified first using the Identify User action before tracking events for them. Rate limit: 1000 requests per 60 seconds per project. |
| `GLEAP_UNARCHIVE_A_TICKET` | Unarchive a Ticket | Tool to unarchive a ticket. Use when you need to restore a previously archived ticket after validation. |
| `GLEAP_UNLINK_A_TICKET` | Unlink a Ticket | Tool to unlink a ticket. Use after confirming both tickets are linked to remove their association. |
| `GLEAP_UNSUBSCRIBE_SESSIONS` | Unsubscribe sessions | Tool to unsubscribe one or more user sessions from communications. Use when users request to stop receiving messages or notifications. |
| `GLEAP_UPDATE_AI_CONTENT_BY_CONTENT_ID` | Update AI Content by Content ID | Tool to update AI content by content ID. Use when modifying existing AI-powered content entries in Gleap. |
| `GLEAP_UPDATE_A_TEAM` | Update a team | Tool to update an existing team. Use when you need to modify team properties like name, assignment method, or members. All fields except the team ID are required in the request body. |
| `GLEAP_UPDATE_A_TICKET` | Update a ticket | Tool to update an existing ticket/bug in Gleap. Use when you need to modify ticket properties like status, priority, description, type, assigned user, tags, or other attributes. All fields except the ticket ID are optional - only provide the fields you want to update. |
| `GLEAP_UPDATE_A_USER_FOR_A_PROJECT` | Update a User for a Project | Tool to update a user’s role in a project. Use when you need to change a user's permissions. |
| `GLEAP_UPDATE_CHAT_MESSAGE` | Update Chat Message | Updates an existing chat message in Gleap by its ID. This action modifies one or more fields of a chat message such as content, status, visibility, and other properties. Use this after creating a chat message to edit its text, change its status from draft to active, or update other metadata. The message ID must be obtained from a prior create or list operation. Common use cases: - Edit message content after sending - Change message status (draft → active) - Toggle message visibility (hidden/shown) - Update message metadata (name, sound settings) |
| `GLEAP_UPDATE_CHECKLIST` | Update a Checklist | Tool to update an engagement checklist by its ID. Use to modify checklist properties such as name, description, status, items, and other configuration options. |
| `GLEAP_UPDATE_ENGAGEMENT_BANNER` | Update Engagement Banner | Tool to update an engagement banner. Use when modifying banner properties like name, status, targeting, or scheduling. |
| `GLEAP_UPDATE_ENGAGEMENT_COBROWSE` | Update Engagement Cobrowse | Tool to update an existing cobrowse product tour. Use when you need to modify properties like name, description, status, or configuration of an interactive guided tour. |
| `GLEAP_UPDATE_ENGAGEMENT_EMAIL` | Update Engagement Email | Tool to update an existing engagement email. Use when you need to modify properties like name, subject, content, status, or targeting settings of an email campaign. |
| `GLEAP_UPDATE_ENGAGEMENT_MODAL` | Update Engagement Modal | Tool to update an existing engagement modal. Use when you need to modify properties like name, status, format, or targeting configuration of a modal dialog. |
| `GLEAP_UPDATE_ENGAGEMENT_NEWS` | Update Engagement News | Tool to update an engagement news article. Use when modifying news article properties like name, status, scheduling, targeting, or other attributes. |
| `GLEAP_UPDATE_ENGAGEMENT_PRODUCT_TOUR` | Update Engagement Product Tour | Tool to update an existing product tour. Use when you need to modify properties like name, status, configuration, or targeting of a product tour. |
| `GLEAP_UPDATE_ENGAGEMENT_PUSH_NOTIFICATION` | Update Engagement Push Notification | Tool to update an existing push notification. Use when you need to modify properties like title, message, status, targeting, or scheduling of a push notification. |
| `GLEAP_UPDATE_ENGAGEMENT_SURVEYS` | Update Engagement Survey | Tool to update an existing engagement survey in Gleap. Use when you need to modify survey properties like name, status, type, format, frequency settings, or targeting. Only the surveyId is required; all other fields are optional - provide only the fields you want to update. |
| `GLEAP_UPDATE_ENGAGEMENT_TOOLTIPS` | Update Engagement Tooltips | Tool to update an engagement tooltip. Use when modifying tooltip properties like name, active status, targeting, or frequency settings. |
| `GLEAP_UPDATE_ENGAGEMENT_WHATSAPP_MESSAGE` | Update Engagement WhatsApp Message | Tool to update an existing engagement WhatsApp message. Use when you need to modify properties like name, status, or targeting settings of a WhatsApp message campaign. |
| `GLEAP_UPDATE_HELPCENTER_COLLECTION` | Update Helpcenter Collection | Tool to update a help center collection. Use when you need to modify an existing collection's properties such as title, description, icon, audience filters, or organizational structure. All fields except the collection ID are optional - only provide the fields you want to update. |
| `GLEAP_UPDATE_HELPCENTER_REDIRECT` | Update help center redirect | Tool to update an existing help center redirect. Use when you need to modify the URL paths or match type of an existing redirect rule. This allows you to change where old URLs redirect to or update the matching strategy. |
| `GLEAP_UPDATE_MESSAGE_TEMPLATE` | Update message template | Tool to update an existing message template in Gleap. Use when you need to modify template properties like title, content, ordering, visibility, or associated actions. All fields except the template ID, title, content, and lexorank are optional. |
| `GLEAP_UPDATE_PROJECT` | Update project | Tool to update a Gleap project's configuration including name, description, notification settings, and feedback tags. Use when you need to modify project settings such as enabling/disabling notifications, updating contact information, or managing feedback categories. Rate limit: 1000 requests per minute. |
| `GLEAP_UPDATE_QA_ANSWER` | Update QA Answer | Updates an existing QA answer/snippet in Gleap. Use when you need to modify the question, answer, tags, or other properties of a snippet. Only the fields you provide will be updated; omitted fields remain unchanged. |
| `GLEAP_UPDATE_SESSION` | Update a session | Tool to update an existing session in Gleap. Use when you need to modify session properties like user information (name, email, phone), custom data, tags, or other session attributes. All fields except the session ID are optional - only provide the fields you want to update. |
| `GLEAP_UPDATE_USER` | Update user | Tool to update a user's profile information including name, availability, profile image, onboarding status, and notification settings. Use when you need to modify user profile data or preferences. Use 'me' as the user_id to update the authenticated user. |
| `GLEAP_VOTE_FOR_TICKET` | Vote for ticket | Tool to vote for a ticket in Gleap. Use when users want to upvote or show support for a specific ticket or feature request. Each email can only vote once per ticket to prevent duplicate votes. |

## Supported Triggers

None listed.

## Creating MCP Server - Stand-alone vs Composio SDK

The Gleap MCP server is an implementation of the Model Context Protocol that connects your AI agent to Gleap. It provides structured and secure access so your agent can perform Gleap operations on your behalf through a secure, permission-based interface.
With Composio's managed implementation, you don't have to create your own developer app. For production, if you're building an end product, we recommend using your own credentials. The managed server helps you prototype fast and go from 0-1 faster.

## Step-by-step Guide

### 1. Prerequisites

Before you begin, make sure you have:
- Python 3.8/Node 16 or higher installed
- A Composio account with the API key
- An OpenAI API key
- A Gleap account and project
- Basic familiarity with async Python/Typescript

### 1. Getting API Keys for OpenAI, Composio, and Gleap

No description provided.

### 2. Installing dependencies

No description provided.
```python
pip install composio-llamaindex llama-index llama-index-llms-openai llama-index-tools-mcp python-dotenv
```

```typescript
npm install @composio/llamaindex @llamaindex/openai @llamaindex/tools @llamaindex/workflow dotenv
```

### 3. Set environment variables

Create a .env file in your project root:
These credentials will be used to:
- Authenticate with OpenAI's GPT-5 model
- Connect to Composio's Tool Router
- Identify your Composio user session for Gleap access
```bash
OPENAI_API_KEY=your-openai-api-key
COMPOSIO_API_KEY=your-composio-api-key
COMPOSIO_USER_ID=your-user-id
```

### 4. Import modules

No description provided.
```python
import asyncio
import os
import dotenv

from composio import Composio
from composio_llamaindex import LlamaIndexProvider
from llama_index.core.agent.workflow import ReActAgent
from llama_index.core.workflow import Context
from llama_index.llms.openai import OpenAI
from llama_index.tools.mcp import BasicMCPClient, McpToolSpec

dotenv.load_dotenv()
```

```typescript
import "dotenv/config";
import readline from "node:readline/promises";
import { stdin as input, stdout as output } from "node:process";

import { Composio } from "@composio/core";

import { mcp } from "@llamaindex/tools";
import { agent as createAgent } from "@llamaindex/workflow";
import { openai } from "@llamaindex/openai";

dotenv.config();
```

### 5. Load environment variables and initialize Composio

No description provided.
```python
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
COMPOSIO_API_KEY = os.getenv("COMPOSIO_API_KEY")
COMPOSIO_USER_ID = os.getenv("COMPOSIO_USER_ID")

if not OPENAI_API_KEY:
    raise ValueError("OPENAI_API_KEY is not set in the environment")
if not COMPOSIO_API_KEY:
    raise ValueError("COMPOSIO_API_KEY is not set in the environment")
if not COMPOSIO_USER_ID:
    raise ValueError("COMPOSIO_USER_ID is not set in the environment")
```

```typescript
const OPENAI_API_KEY = process.env.OPENAI_API_KEY;
const COMPOSIO_API_KEY = process.env.COMPOSIO_API_KEY;
const COMPOSIO_USER_ID = process.env.COMPOSIO_USER_ID;

if (!OPENAI_API_KEY) throw new Error("OPENAI_API_KEY is not set");
if (!COMPOSIO_API_KEY) throw new Error("COMPOSIO_API_KEY is not set");
if (!COMPOSIO_USER_ID) throw new Error("COMPOSIO_USER_ID is not set");
```

### 6. Create a Tool Router session and build the agent function

What's happening here:
- We create a Composio client using your API key and configure it with the LlamaIndex provider
- We then create a tool router MCP session for your user, specifying the toolkits we want to use (in this case, gleap)
- The session returns an MCP HTTP endpoint URL that acts as a gateway to all your configured tools
- LlamaIndex will connect to this endpoint to dynamically discover and use the available Gleap tools.
- The MCP tools are mapped to LlamaIndex-compatible tools and plug them into the Agent.
```python
async def build_agent() -> ReActAgent:
    composio_client = Composio(
        api_key=COMPOSIO_API_KEY,
        provider=LlamaIndexProvider(),
    )

    session = composio_client.create(
        user_id=COMPOSIO_USER_ID,
        toolkits=["gleap"],
    )

    mcp_url = session.mcp.url
    print(f"Composio MCP URL: {mcp_url}")

    mcp_client = BasicMCPClient(mcp_url, headers={"x-api-key": COMPOSIO_API_KEY})
    mcp_tool_spec = McpToolSpec(client=mcp_client)
    tools = await mcp_tool_spec.to_tool_list_async()

    llm = OpenAI(model="gpt-5")

    description = "An agent that uses Composio Tool Router MCP tools to perform Gleap actions."
    system_prompt = """
    You are a helpful assistant connected to Composio Tool Router.
    Use the available tools to answer user queries and perform Gleap actions.
    """
    return ReActAgent(tools=tools, llm=llm, description=description, system_prompt=system_prompt, verbose=True)
```

```typescript
async function buildAgent() {

  console.log(`Initializing Composio client...${COMPOSIO_USER_ID!}...`);
  console.log(`COMPOSIO_USER_ID: ${COMPOSIO_USER_ID!}...`);

  const composio = new Composio({
    apiKey: COMPOSIO_API_KEY,
    provider: new LlamaindexProvider(),
  });

  const session = await composio.create(
    COMPOSIO_USER_ID!,
    {
      toolkits: ["gleap"],
    },
  );

  const mcpUrl = session.mcp.url;
  console.log(`Composio Tool Router MCP URL: ${mcpUrl}`);

  const server = mcp({
    url: mcpUrl,
    clientName: "composio_tool_router_with_llamaindex",
    requestInit: {
      headers: {
        "x-api-key": COMPOSIO_API_KEY!,
      },
    },
    // verbose: true,
  });

  const tools = await server.tools();

  const llm = openai({ apiKey: OPENAI_API_KEY, model: "gpt-5" });

  const agent = createAgent({
    name: "composio_tool_router_with_llamaindex",
        description : "An agent that uses Composio Tool Router MCP tools to perform actions.",
    systemPrompt:
      "You are a helpful assistant connected to Composio Tool Router."+
"Use the available tools to answer user queries and perform Gleap actions." ,
    llm,
    tools,
  });

  return agent;
}
```

### 7. Create an interactive chat loop

No description provided.
```python
async def chat_loop(agent: ReActAgent) -> None:
    ctx = Context(agent)
    print("Type 'quit', 'exit', or Ctrl+C to stop.")

    while True:
        try:
            user_input = input("\nYou: ").strip()
        except (KeyboardInterrupt, EOFError):
            print("\nBye!")
            break

        if not user_input or user_input.lower() in {"quit", "exit"}:
            print("Bye!")
            break

        try:
            print("Agent: ", end="", flush=True)
            handler = agent.run(user_input, ctx=ctx)

            async for event in handler.stream_events():
                # Stream token-by-token from LLM responses
                if hasattr(event, "delta") and event.delta:
                    print(event.delta, end="", flush=True)
                # Show tool calls as they happen
                elif hasattr(event, "tool_name"):
                    print(f"\n[Using tool: {event.tool_name}]", flush=True)

            # Get final response
            response = await handler
            print()  # Newline after streaming
        except KeyboardInterrupt:
            print("\n[Interrupted]")
            continue
        except Exception as e:
            print(f"\nError: {e}")
```

```typescript
async function chatLoop(agent: ReturnType<typeof createAgent>) {
  const rl = readline.createInterface({ input, output });

  console.log("Type 'quit' or 'exit' to stop.");

  while (true) {
    let userInput: string;

    try {
      userInput = (await rl.question("\nYou: ")).trim();
    } catch {
      console.log("\nAgent: Bye!");
      break;
    }

    if (!userInput) {
      continue;
    }

    const lower = userInput.toLowerCase();
    if (lower === "quit" || lower === "exit") {
      console.log("Agent: Bye!");
      break;
    }

    try {
      process.stdout.write("Agent: ");

      const stream = agent.runStream(userInput);
      let finalResult: any = null;

      for await (const event of stream) {
        // The event.data contains the streamed content
        const data: any = event.data;

        // Check for streaming delta content
        if (data?.delta) {
          process.stdout.write(data.delta);
        }

        // Store final result for fallback
        if (data?.result || data?.message) {
          finalResult = data;
        }
      }

      // If no streaming happened, show the final result
      if (finalResult) {
        const answer =
          finalResult.result ??
          finalResult.message?.content ??
          finalResult.message ??
          "";
        if (answer && typeof answer === "string" && !answer.includes("[object")) {
          process.stdout.write(answer);
        }
      }

      console.log(); // New line after streaming completes
    } catch (err: any) {
      console.error("\nAgent error:", err?.message ?? err);
    }
  }

  rl.close();
}
```

### 8. Define the main entry point

What's happening here:
- We're orchestrating the entire application flow
- The agent gets built with proper error handling
- Then we kick off the interactive chat loop so you can start talking to Gleap
```python
async def main() -> None:
    agent = await build_agent()
    await chat_loop(agent)

if __name__ == "__main__":
    # Handle Ctrl+C gracefully
    signal.signal(signal.SIGINT, lambda s, f: (print("\nBye!"), exit(0)))
    try:
        asyncio.run(main())
    except KeyboardInterrupt:
        print("\nBye!")
```

```typescript
async function main() {
  try {
    const agent = await buildAgent();
    await chatLoop(agent);
  } catch (err) {
    console.error("Failed to start agent:", err);
    process.exit(1);
  }
}

main();
```

### 9. Run the agent

When prompted, authenticate and authorise your agent with Gleap, then start asking questions.
```bash
python llamaindex_agent.py
```

```typescript
npx ts-node llamaindex-agent.ts
```

## Complete Code

```python
import asyncio
import os
import signal
import dotenv

from composio import Composio
from composio_llamaindex import LlamaIndexProvider
from llama_index.core.agent.workflow import ReActAgent
from llama_index.core.workflow import Context
from llama_index.llms.openai import OpenAI
from llama_index.tools.mcp import BasicMCPClient, McpToolSpec

dotenv.load_dotenv()

OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
COMPOSIO_API_KEY = os.getenv("COMPOSIO_API_KEY")
COMPOSIO_USER_ID = os.getenv("COMPOSIO_USER_ID")

if not OPENAI_API_KEY:
    raise ValueError("OPENAI_API_KEY is not set")
if not COMPOSIO_API_KEY:
    raise ValueError("COMPOSIO_API_KEY is not set")
if not COMPOSIO_USER_ID:
    raise ValueError("COMPOSIO_USER_ID is not set")

async def build_agent() -> ReActAgent:
    composio_client = Composio(
        api_key=COMPOSIO_API_KEY,
        provider=LlamaIndexProvider(),
    )

    session = composio_client.create(
        user_id=COMPOSIO_USER_ID,
        toolkits=["gleap"],
    )

    mcp_url = session.mcp.url
    print(f"Composio MCP URL: {mcp_url}")

    mcp_client = BasicMCPClient(mcp_url, headers={"x-api-key": COMPOSIO_API_KEY})
    mcp_tool_spec = McpToolSpec(client=mcp_client)
    tools = await mcp_tool_spec.to_tool_list_async()

    llm = OpenAI(model="gpt-5")
    description = "An agent that uses Composio Tool Router MCP tools to perform Gleap actions."
    system_prompt = """
    You are a helpful assistant connected to Composio Tool Router.
    Use the available tools to answer user queries and perform Gleap actions.
    """
    return ReActAgent(
        tools=tools,
        llm=llm,
        description=description,
        system_prompt=system_prompt,
        verbose=True,
    );

async def chat_loop(agent: ReActAgent) -> None:
    ctx = Context(agent)
    print("Type 'quit', 'exit', or Ctrl+C to stop.")

    while True:
        try:
            user_input = input("\nYou: ").strip()
        except (KeyboardInterrupt, EOFError):
            print("\nBye!")
            break

        if not user_input or user_input.lower() in {"quit", "exit"}:
            print("Bye!")
            break

        try:
            print("Agent: ", end="", flush=True)
            handler = agent.run(user_input, ctx=ctx)

            async for event in handler.stream_events():
                # Stream token-by-token from LLM responses
                if hasattr(event, "delta") and event.delta:
                    print(event.delta, end="", flush=True)
                # Show tool calls as they happen
                elif hasattr(event, "tool_name"):
                    print(f"\n[Using tool: {event.tool_name}]", flush=True)

            # Get final response
            response = await handler
            print()  # Newline after streaming
        except KeyboardInterrupt:
            print("\n[Interrupted]")
            continue
        except Exception as e:
            print(f"\nError: {e}")

async def main() -> None:
    agent = await build_agent()
    await chat_loop(agent)

if __name__ == "__main__":
    # Handle Ctrl+C gracefully
    signal.signal(signal.SIGINT, lambda s, f: (print("\nBye!"), exit(0)))
    try:
        asyncio.run(main())
    except KeyboardInterrupt:
        print("\nBye!")
```

```typescript
import "dotenv/config";
import readline from "node:readline/promises";
import { stdin as input, stdout as output } from "node:process";

import { Composio } from "@composio/core";
import { LlamaindexProvider } from "@composio/llamaindex";

import { mcp } from "@llamaindex/tools";
import { agent as createAgent } from "@llamaindex/workflow";
import { openai } from "@llamaindex/openai";

dotenv.config();

const OPENAI_API_KEY = process.env.OPENAI_API_KEY;
const COMPOSIO_API_KEY = process.env.COMPOSIO_API_KEY;
const COMPOSIO_USER_ID = process.env.COMPOSIO_USER_ID;

if (!OPENAI_API_KEY) {
    throw new Error("OPENAI_API_KEY is not set in the environment");
  }
if (!COMPOSIO_API_KEY) {
    throw new Error("COMPOSIO_API_KEY is not set in the environment");
  }
if (!COMPOSIO_USER_ID) {
    throw new Error("COMPOSIO_USER_ID is not set in the environment");
  }

async function buildAgent() {

  console.log(`Initializing Composio client...${COMPOSIO_USER_ID!}...`);
  console.log(`COMPOSIO_USER_ID: ${COMPOSIO_USER_ID!}...`);

  const composio = new Composio({
    apiKey: COMPOSIO_API_KEY,
    provider: new LlamaindexProvider(),
  });

  const session = await composio.create(
    COMPOSIO_USER_ID!,
    {
      toolkits: ["gleap"],
    },
  );

  const mcpUrl = session.mcp.url;
  console.log(`Composio Tool Router MCP URL: ${mcpUrl}`);

  const server = mcp({
    url: mcpUrl,
    clientName: "composio_tool_router_with_llamaindex",
    requestInit: {
      headers: {
        "x-api-key": COMPOSIO_API_KEY!,
      },
    },
    // verbose: true,
  });

  const tools = await server.tools();

  const llm = openai({ apiKey: OPENAI_API_KEY, model: "gpt-5" });

  const agent = createAgent({
    name: "composio_tool_router_with_llamaindex",
    description:
      "An agent that uses Composio Tool Router MCP tools to perform actions.",
    systemPrompt:
      "You are a helpful assistant connected to Composio Tool Router."+
"Use the available tools to answer user queries and perform Gleap actions." ,
    llm,
    tools,
  });

  return agent;
}

async function chatLoop(agent: ReturnType<typeof createAgent>) {
  const rl = readline.createInterface({ input, output });

  console.log("Type 'quit' or 'exit' to stop.");

  while (true) {
    let userInput: string;

    try {
      userInput = (await rl.question("\nYou: ")).trim();
    } catch {
      console.log("\nAgent: Bye!");
      break;
    }

    if (!userInput) {
      continue;
    }

    const lower = userInput.toLowerCase();
    if (lower === "quit" || lower === "exit") {
      console.log("Agent: Bye!");
      break;
    }

    try {
      process.stdout.write("Agent: ");

      const stream = agent.runStream(userInput);
      let finalResult: any = null;

      for await (const event of stream) {
        // The event.data contains the streamed content
        const data: any = event.data;

        // Check for streaming delta content
        if (data?.delta) {
          process.stdout.write(data.delta);
        }

        // Store final result for fallback
        if (data?.result || data?.message) {
          finalResult = data;
        }
      }

      // If no streaming happened, show the final result
      if (finalResult) {
        const answer =
          finalResult.result ??
          finalResult.message?.content ??
          finalResult.message ??
          "";
        if (answer && typeof answer === "string" && !answer.includes("[object")) {
          process.stdout.write(answer);
        }
      }

      console.log(); // New line after streaming completes
    } catch (err: any) {
      console.error("\nAgent error:", err?.message ?? err);
    }
  }

  rl.close();
}

async function main() {
  try {
    const agent = await buildAgent();
    await chatLoop(agent);
  } catch (err: any) {
    console.error("Failed to start agent:", err?.message ?? err);
    process.exit(1);
  }
}

main();
```

## Conclusion

You've successfully connected Gleap to LlamaIndex through Composio's Tool Router MCP layer.
Key takeaways:
- Tool Router dynamically exposes Gleap tools through an MCP endpoint
- LlamaIndex's ReActAgent handles reasoning and orchestration; Composio handles integrations
- The agent becomes more capable without increasing prompt size
- Async Python provides clean, efficient execution of agent workflows
You can easily extend this to other toolkits like Gmail, Notion, Stripe, GitHub, and more by adding them to the toolkits parameter.

## How to build Gleap MCP Agent with another framework

- [OpenAI Agents SDK](https://composio.dev/toolkits/gleap/framework/open-ai-agents-sdk)
- [Claude Agent SDK](https://composio.dev/toolkits/gleap/framework/claude-agents-sdk)
- [Claude Code](https://composio.dev/toolkits/gleap/framework/claude-code)
- [Claude Cowork](https://composio.dev/toolkits/gleap/framework/claude-cowork)
- [Codex](https://composio.dev/toolkits/gleap/framework/codex)
- [OpenClaw](https://composio.dev/toolkits/gleap/framework/openclaw)
- [Hermes](https://composio.dev/toolkits/gleap/framework/hermes-agent)
- [CLI](https://composio.dev/toolkits/gleap/framework/cli)
- [Google ADK](https://composio.dev/toolkits/gleap/framework/google-adk)
- [LangChain](https://composio.dev/toolkits/gleap/framework/langchain)
- [Vercel AI SDK](https://composio.dev/toolkits/gleap/framework/ai-sdk)
- [Mastra AI](https://composio.dev/toolkits/gleap/framework/mastra-ai)
- [CrewAI](https://composio.dev/toolkits/gleap/framework/crew-ai)

## Related Toolkits

- [Aeroleads](https://composio.dev/toolkits/aeroleads) - Aeroleads is a B2B lead generation platform for finding business emails and phone numbers. Grow your sales pipeline faster with powerful prospecting tools.
- [Autobound](https://composio.dev/toolkits/autobound) - Autobound is an AI-powered sales engagement platform that crafts hyper-personalized outreach and insights. It helps sales teams boost response rates and close more deals through tailored content and recommendations.
- [Better proposals](https://composio.dev/toolkits/better_proposals) - Better Proposals is a web-based tool for crafting and sending professional proposals. It helps teams impress clients and close deals faster with slick, easy-to-use templates.
- [Bidsketch](https://composio.dev/toolkits/bidsketch) - Bidsketch is a proposal software that helps businesses create professional proposals quickly and efficiently. It streamlines the proposal process, saving time while boosting client win rates.
- [Bolna](https://composio.dev/toolkits/bolna) - Bolna is an AI platform for building conversational voice agents. It helps businesses automate support and streamline interactions through natural, voice-powered conversations.
- [Botsonic](https://composio.dev/toolkits/botsonic) - Botsonic is a no-code AI chatbot builder for easily creating and deploying chatbots to your website. It empowers businesses to offer conversational experiences without writing code.
- [Botstar](https://composio.dev/toolkits/botstar) - BotStar is a comprehensive chatbot platform for designing, developing, and training chatbots visually on Messenger and websites. It helps businesses automate conversations and customer interactions without coding.
- [Callerapi](https://composio.dev/toolkits/callerapi) - CallerAPI is a white-label caller identification platform for branded caller ID and fraud prevention. It helps businesses boost customer trust while stopping spam, fraud, and robocalls.
- [Callingly](https://composio.dev/toolkits/callingly) - Callingly is a lead response management platform that automates immediate call and text follow-ups with new leads. It helps sales teams boost response speed and close more deals by connecting seamlessly with CRMs and lead sources.
- [Callpage](https://composio.dev/toolkits/callpage) - Callpage is a lead capture platform that lets businesses instantly connect with website visitors via callback. It boosts lead generation and increases your sales conversion rates.
- [Clearout](https://composio.dev/toolkits/clearout) - Clearout is an AI-powered service for verifying, finding, and enriching email addresses. It boosts deliverability and helps you discover high-quality leads effortlessly.
- [Clientary](https://composio.dev/toolkits/clientary) - Clientary is a platform for managing clients, invoices, projects, proposals, and more. It streamlines client work and saves you serious admin time.
- [Convolo ai](https://composio.dev/toolkits/convolo_ai) - Convolo ai is an AI-powered communications platform for sales teams. It accelerates lead response and improves conversion rates by automating calls and integrating workflows.
- [Delighted](https://composio.dev/toolkits/delighted) - Delighted is a customer feedback platform based on the Net Promoter System®. It helps you quickly gather, track, and act on customer sentiment.
- [Docsbot ai](https://composio.dev/toolkits/docsbot_ai) - Docsbot ai is a platform that lets you build custom AI chatbots trained on your documentation. It automates customer support and content generation, saving time and improving response quality.
- [Emelia](https://composio.dev/toolkits/emelia) - Emelia is an all-in-one B2B prospecting platform for cold-email, LinkedIn outreach, and prospect research. It streamlines outbound campaigns so you can find, engage, and warm up leads faster.
- [Findymail](https://composio.dev/toolkits/findymail) - Findymail is a B2B data provider offering verified email and phone contacts for sales prospecting. Enhance outreach with automated exports, email verification, and CRM enrichment.
- [Freshdesk](https://composio.dev/toolkits/freshdesk) - Freshdesk is customer support software with ticketing and automation tools. It helps teams streamline helpdesk operations for faster, better customer support.
- [Fullenrich](https://composio.dev/toolkits/fullenrich) - FullEnrich is a B2B contact enrichment platform that aggregates emails and phone numbers from 15+ data vendors. Instantly find and verify lead contact data to boost your outreach.
- [Gatherup](https://composio.dev/toolkits/gatherup) - GatherUp is a customer feedback and online review management platform. It helps businesses boost their reputation by streamlining how they collect and manage customer feedback.

## Frequently Asked Questions

### What are the differences in Tool Router MCP and Gleap MCP?

With a standalone Gleap MCP server, the agents and LLMs can only access a fixed set of Gleap tools tied to that server. However, with the Composio Tool Router, agents can dynamically load tools from Gleap and many other apps based on the task at hand, all through a single MCP endpoint.

### Can I use Tool Router MCP with LlamaIndex?

Yes, you can. LlamaIndex fully supports MCP integration. You get structured tool calling, message history handling, and model orchestration while Tool Router takes care of discovering and serving the right Gleap tools.

### Can I manage the permissions and scopes for Gleap while using Tool Router?

Yes, absolutely. You can configure which Gleap scopes and actions are allowed when connecting your account to Composio. You can also bring your own OAuth credentials or API configuration so you keep full control over what the agent can do.

### How safe is my data with Composio Tool Router?

All sensitive data such as tokens, keys, and configuration is fully encrypted at rest and in transit. Composio is SOC 2 Type 2 compliant and follows strict security practices so your Gleap data and credentials are handled as safely as possible.

---
[See all toolkits](https://composio.dev/toolkits) · [Composio docs](https://docs.composio.dev/llms.txt)
