Skip to main content
Glama
raoulbia-ai

MCP Server for Intercom

search_tickets_by_status

Filter and retrieve Intercom support tickets by status (open, pending, or resolved) with optional date range for efficient workload analysis and issue resolution tracking.

Instructions

Searches for tickets by status with optional date filtering.

Required: status (one of: open, pending, resolved) Optional: startDate, endDate (DD/MM/YYYY format)

Use when analyzing support workload or tracking issue resolution.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endDateNoOptional end date in DD/MM/YYYY format (e.g., '21/01/2025')
startDateNoOptional start date in DD/MM/YYYY format (e.g., '15/01/2025')
statusYesTicket status to search for (open, pending, or resolved)

Implementation Reference

  • The main handler function that executes the tool logic: validates input using SearchTicketsByStatusSchema, fetches tickets via IntercomService.getTicketsByStatus, formats and returns MCP-compliant response or error.
    async handleSearchTicketsByStatus(args: unknown) {
        try {
            console.error("Handling search_tickets_by_status request");
            
            // Validate and parse arguments
            const validatedArgs = SearchTicketsByStatusSchema.parse(args);
            
            const status = validatedArgs.status;
            const startDateStr = validatedArgs.startDate;
            const endDateStr = validatedArgs.endDate;
            
            // Create Intercom service and retrieve tickets
            const intercomService = new IntercomService(this.API_BASE_URL, this.authToken);
            const tickets = await intercomService.getTicketsByStatus(
                status,
                startDateStr,
                endDateStr
            );
            
            console.error(`Retrieved ${tickets.length} tickets with status: ${status}`);
            
            return this.formatResponse(tickets);
        } catch (error) {
            console.error('Error handling search_tickets_by_status:', error);
            
            // Enhanced error message for validation errors
            if (error instanceof Error && error.message.includes("status")) {
                return this.formatErrorResponse(error, 
                    `${error.message}\n\nPlease provide a valid status (open, pending, or resolved), and optional dates in DD/MM/YYYY format (e.g., 15/01/2025)`
                );
            }
            
            return this.formatErrorResponse(error);
        }
    }
  • Zod schema defining input validation for the tool: requires 'status' (open/pending/resolved), optional 'startDate' and 'endDate' in DD/MM/YYYY, with transformation to ISO dates and range validation.
    export const SearchTicketsByStatusSchema = z.object({
        // Required status parameter
        status: z.string({
            required_error: "status is required (open, pending, or resolved)"
        }).refine(val => ['open', 'pending', 'resolved'].includes(val.toLowerCase()), {
            message: "status must be one of: open, pending, resolved"
        }),
        
        // Optional date range parameters in DD/MM/YYYY format
        startDate: z.string().optional().refine(val => !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().optional().refine(val => !val || /^\d{2}\/\d{2}\/\d{4}$/.test(val), {
            message: "endDate must be in DD/MM/YYYY format (e.g., 21/01/2025)"
        })
    }).transform(data => {
        console.error("Raw arguments received:", JSON.stringify(data));
        
        try {
            // Convert DD/MM/YYYY to ISO strings if provided
            if (data.startDate) {
                data.startDate = validateAndTransformDate(data.startDate, true);
            }
            
            if (data.endDate) {
                data.endDate = validateAndTransformDate(data.endDate, false);
            }
            
            // Validate date range if both dates are provided
            if (data.startDate && data.endDate) {
                validateDateRange(data.startDate, data.endDate);
            }
            
        } 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;
    });
  • src/index.ts:51-72 (registration)
    Registers the tool in the MCP server capabilities bundle, specifying name, description, and input parameters schema.
    search_tickets_by_status: {
        description: "Searches for tickets by status with optional date filtering.",
        parameters: {
            type: "object",
            required: ["status"],
            properties: {
                status: {
                    type: "string",
                    description: "Ticket status to search for (open, pending, or resolved)",
                    enum: ["open", "pending", "resolved"]
                },
                startDate: {
                    type: "string",
                    description: "Optional start date in DD/MM/YYYY format (e.g., '15/01/2025')"
                },
                endDate: {
                    type: "string",
                    description: "Optional end date in DD/MM/YYYY format (e.g., '21/01/2025')"
                }
            }
        }
    },
  • Switch case in call_tool request handler that dispatches 'search_tickets_by_status' requests to the ToolHandlers.handleSearchTicketsByStatus method.
    case "search_tickets_by_status":
        console.error("Handling search_tickets_by_status request");
        return await toolHandlers.handleSearchTicketsByStatus(args);
Behavior2/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. While it mentions the search functionality and date format, it lacks critical behavioral details: it doesn't specify whether this is a read-only operation, what permissions might be required, how results are returned (e.g., pagination, format), or any rate limits. For a search tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

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

The description is efficiently structured with three sentences: purpose statement, parameter requirements, and usage guidelines. Each sentence adds distinct value without redundancy. It's appropriately sized and front-loaded with the core functionality.

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 no annotations and no output schema, the description is moderately complete for a search tool. It covers the basic purpose, parameters, and usage context, but lacks details about behavioral aspects (e.g., read-only nature, result format, error handling) and doesn't fully address sibling tool differentiation. For a tool with 3 parameters and no structured safety hints, more behavioral context would be beneficial.

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?

The schema description coverage is 100%, with all parameters well-documented in the schema (status with enum values, startDate/endDate with format). The description adds minimal value beyond the schema: it repeats the status options and date format, but doesn't provide additional context like how date filtering interacts with status or example use cases for the parameters. This meets the baseline for high schema coverage.

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: 'Searches for tickets by status with optional date filtering.' This specifies the verb ('searches'), resource ('tickets'), and scope ('by status with optional date filtering'). However, it doesn't explicitly differentiate from sibling tools like 'search_tickets_by_customer' or 'search_conversations_by_customer', which would require mentioning customer vs. status filtering.

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 usage context: 'Use when analyzing support workload or tracking issue resolution.' This gives practical scenarios for when to use the tool. However, it doesn't explicitly state when NOT to use it or mention alternatives like the sibling tools, which would be needed for a perfect score.

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