Skip to main content
Glama
raoulbia-ai

MCP Server for Intercom

list_conversations

Retrieve Intercom conversations within a specific date range using startDate and endDate (DD/MM/YYYY format). Filter results by keyword or exclude content as needed. Ideal for analyzing support ticket history.

Instructions

Retrieves Intercom conversations within a specific date range.

Required: startDate, endDate (DD/MM/YYYY format, max 7-day range) Optional: keyword, exclude (for content filtering)

Always ask for specific dates when user makes vague time references.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endDateYesEnd date in DD/MM/YYYY format (e.g., '21/01/2025'). Required.
excludeNoOptional exclusion filter for conversation content.
keywordNoOptional keyword to filter conversations by content.
startDateYesStart date in DD/MM/YYYY format (e.g., '15/01/2025'). Required.

Implementation Reference

  • Core handler function executing the list_conversations tool: validates arguments with schema, calls Intercom service to fetch conversations by date range and filters, formats MCP-compliant response or error.
    async handleListConversations(args: unknown) {
        try {
            console.error("Handling list_conversations request");
            
            // Validate and parse arguments
            const validatedArgs = ListConversationsArgumentsSchema.parse(args);
            
            const startDateStr = validatedArgs.startDate;
            const endDateStr = validatedArgs.endDate;
            const keyword = validatedArgs.keyword;
            const exclude = validatedArgs.exclude;
            
            // Create Intercom service and retrieve conversations
            const intercomService = new IntercomService(this.API_BASE_URL, this.authToken);
            const conversations = await intercomService.getConversations(
                startDateStr, 
                endDateStr, 
                keyword, 
                exclude
            );
            
            console.error(`Retrieved ${conversations.length} conversations within date range`);
            
            return this.formatResponse(conversations);
        } catch (error) {
            console.error('Error handling list_conversations:', error);
            
            // Enhanced error message for validation errors
            if (error instanceof Error && (error.message.includes("startDate") || error.message.includes("endDate"))) {
                return this.formatErrorResponse(error, 
                    `${error.message}\n\nPlease provide both startDate and endDate in DD/MM/YYYY format (e.g., 15/01/2025)`
                );
            }
            
            return this.formatErrorResponse(error);
        }
    }
  • Zod schema for validating and transforming list_conversations input arguments, including date format checks, range validation (max 7 days), and conversion to ISO format.
    export const ListConversationsArgumentsSchema = z.object({
        // Required date range parameters in DD/MM/YYYY format
        startDate: z.string({
            required_error: "startDate is required in DD/MM/YYYY format (e.g., 15/01/2025)"
        }).refine(val => /^\d{2}\/\d{2}\/\d{4}$/.test(val), {
            message: "startDate must be in DD/MM/YYYY format (e.g., 15/01/2025)"
        }),
        
        endDate: z.string({
            required_error: "endDate is required in DD/MM/YYYY format (e.g., 21/01/2025)"
        }).refine(val => /^\d{2}\/\d{2}\/\d{4}$/.test(val), {
            message: "endDate must be in DD/MM/YYYY format (e.g., 21/01/2025)"
        }),
        
        // Optional string filters
        keyword: z.string().optional(),
        exclude: z.string().optional()
    }).transform(data => {
        console.error("Raw arguments received:", JSON.stringify(data));
        
        try {
            // Convert DD/MM/YYYY to ISO strings
            data.startDate = validateAndTransformDate(data.startDate, true);
            data.endDate = validateAndTransformDate(data.endDate, false);
            
            // Validate date range
            validateDateRange(data.startDate, data.endDate);
            
            // Enforce 7-day maximum range
            validateMaxDateRange(data.startDate, data.endDate, 7);
            
        } catch (e) {
            // Throw error to be caught by the handler
            console.error(`Error processing date parameters: ${e}`);
            throw new Error(`${e instanceof Error ? e.message : 'Invalid date format'} - Please provide dates in DD/MM/YYYY format (e.g., 15/01/2025)`);
        }
        
        console.error("Final parameters:", JSON.stringify(data));
        return data;
    });
  • Dispatch logic in CallToolRequest handler that routes list_conversations calls to the toolHandlers.handleListConversations method.
    case "list_conversations":
        console.error("Handling list_conversations request");
        return await toolHandlers.handleListConversations(args);
  • src/index.ts:94-118 (registration)
    MCP server capabilities registration defining the list_conversations tool's description and input parameters schema.
    list_conversations: {
        description: "Retrieves Intercom conversations within a specific date range (max 7 days).",
        parameters: {
            type: "object",
            required: ["startDate", "endDate"],
            properties: {
                startDate: {
                    type: "string",
                    description: "Start date in DD/MM/YYYY format (e.g., '15/01/2025'). Required."
                },
                endDate: {
                    type: "string",
                    description: "End date in DD/MM/YYYY format (e.g., '21/01/2025'). Required."
                },
                keyword: {
                    type: "string",
                    description: "Optional keyword to filter conversations by content."
                },
                exclude: {
                    type: "string",
                    description: "Optional exclusion filter for conversation content."
                }
            }
        }
    }
  • Tool metadata (name, description, inputSchema) provided in response to list_tools requests.
                        name: "list_conversations",
                        description: `Retrieves Intercom conversations within a specific date range.
    
    Required: startDate, endDate (DD/MM/YYYY format, max 7-day range)
    Optional: keyword, exclude (for content filtering)
    
    Always ask for specific dates when user makes vague time references.`,
                        inputSchema: {
                            type: "object",
                            required: ["startDate", "endDate"],
                            properties: {
                                startDate: {
                                    type: "string",
                                    description: "Start date in DD/MM/YYYY format (e.g., '15/01/2025'). Required."
                                },
                                endDate: {
                                    type: "string",
                                    description: "End date in DD/MM/YYYY format (e.g., '21/01/2025'). Required."
                                },
                                keyword: {
                                    type: "string",
                                    description: "Optional keyword to filter conversations by content."
                                },
                                exclude: {
                                    type: "string",
                                    description: "Optional exclusion filter for conversation content."
                                }
                            }
                        },
                    },
Behavior3/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 adds some context beyond basic functionality: it specifies the date format (DD/MM/YYYY), max range (7 days), and that parameters are required or optional. However, it doesn't cover important behavioral aspects like rate limits, authentication needs, pagination, or what the return format looks like (especially since there's no output schema). For a tool with no annotations, this leaves gaps 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.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded: the first sentence states the core purpose, followed by details on parameters and a usage directive. Each sentence adds value, with no wasted words. It could be slightly more structured (e.g., bullet points for parameters), but it's efficient and clear.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (a retrieval tool with 4 parameters), no annotations, and no output schema, the description is somewhat complete but has gaps. It covers the basic purpose, parameter requirements, and a usage tip, but lacks details on behavioral traits (e.g., rate limits), output format, and how it differs from siblings. For a tool without structured support, it should do more to compensate.

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?

Schema description coverage is 100%, meaning the input schema already documents all parameters thoroughly. The description adds minimal value beyond the schema: it reiterates that startDate and endDate are required and in DD/MM/YYYY format, and mentions the max 7-day range (which isn't in the schema). However, it doesn't provide additional semantic context for the optional parameters (keyword, exclude) or explain their interactions. Baseline 3 is appropriate when the schema does most of the work.

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: 'Retrieves Intercom conversations within a specific date range.' This specifies the verb ('retrieves'), resource ('Intercom conversations'), and scope ('within a specific date range'). However, it doesn't explicitly differentiate from sibling tools like 'search_conversations_by_customer,' which appears to be a more targeted search tool, so it doesn't reach the highest score.

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

Usage Guidelines4/5

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

The description provides clear context for usage: it specifies that the tool is for retrieving conversations within a date range and includes a directive to 'Always ask for specific dates when user makes vague time references.' This offers practical guidance on when to use it (for date-based retrieval) and how to handle ambiguous inputs. However, it doesn't explicitly state when not to use it or mention alternatives like the sibling tools, so it's not a perfect 5.

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

Related 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/raoulbia-ai/mcp-server-for-intercom'

If you have feedback or need assistance with the MCP directory API, please join our Discord server