Skip to main content
Glama
fabian1710

MCP Intercom Server

by fabian1710

search-conversations

Search Intercom conversations using filters for creation time, update time, source type, state, and read/open status to find specific customer interactions.

Instructions

Search Intercom conversations with filters for created_at, updated_at, source type, state, open, and read status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
createdAtNo
updatedAtNo
sourceTypeNoSource type of the conversation (e.g., "email", "chat")
stateNoConversation state to filter by (e.g., "open", "closed")
openNoFilter by open status
readNoFilter by read status

Implementation Reference

  • The MCP tool handler for 'search-conversations' that validates the input arguments using SearchConversationsSchema and executes the search via IntercomClient.
    if (name === "search-conversations") {
      try {
        const validatedArgs = SearchConversationsSchema.parse(args);
        const intercomClient = new IntercomClient();
        const conversations = await intercomClient.searchConversations(
          validatedArgs
        );
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(conversations, null, 2),
            },
          ],
        };
      } catch (error) {
        if (error instanceof Error) {
          return {
            content: [
              {
                type: "text",
                text: `Error: ${error.message}`,
              },
            ],
          };
        }
        throw error;
      }
    }
  • Zod schema defining the input parameters for the 'search-conversations' tool, including optional filters for createdAt, updatedAt, sourceType, state, open, and read.
    export const SearchConversationsSchema = z.object({
      createdAt: z
        .object({
          operator: z.enum(["=", "!=", ">", "<"]),
          value: z.number(),
        })
        .optional(),
      updatedAt: z
        .object({
          operator: z.enum(["=", "!=", ">", "<"]),
          value: z.number(),
        })
        .optional(),
      sourceType: z.string().optional(),
      state: z.string().optional(),
      open: z.boolean().optional(),
      read: z.boolean().optional(),
      // Add more filters as needed
    });
  • src/index.ts:18-22 (registration)
    Registration of the 'search-conversations' tool in the MCP server capabilities, specifying description, inputSchema, and outputSchema.
    "search-conversations": {
      description:
        "Search Intercom conversations with filters for created_at, updated_at, source type, state, open, and read status",
      inputSchema: SearchConversationsSchema,
      outputSchema: z.any(),
  • The IntercomClient.searchConversations method, which constructs the search query for Intercom's conversations/search API endpoint and fetches the results. This is the core logic executed by the tool handler.
    async searchConversations(
      filters: {
        createdAt?: { operator: string; value: number };
        updatedAt?: { operator: string; value: number };
        sourceType?: string;
        state?: string;
        open?: boolean;
        read?: boolean;
        // Add more filters as needed
      } = {},
      pagination: { perPage?: number; startingAfter?: string } = {}
    ) {
      const query: any = {
        operator: "AND",
        value: [],
      };
    
      if (filters.createdAt) {
        query.value.push({
          field: "created_at",
          operator: filters.createdAt.operator,
          value: filters.createdAt.value.toString(),
        });
      }
      if (filters.updatedAt) {
        query.value.push({
          field: "updated_at",
          operator: filters.updatedAt.operator,
          value: filters.updatedAt.value.toString(),
        });
      }
      if (filters.sourceType) {
        query.value.push({
          field: "source.type",
          operator: "=",
          value: filters.sourceType,
        });
      }
      if (filters.state) {
        query.value.push({
          field: "state",
          operator: "=",
          value: filters.state,
        });
      }
      if (filters.open !== undefined) {
        query.value.push({
          field: "open",
          operator: "=",
          value: filters.open.toString(),
        });
      }
      if (filters.read !== undefined) {
        query.value.push({
          field: "read",
          operator: "=",
          value: filters.read.toString(),
        });
      }
    
      const body = {
        query,
        pagination: {
          per_page: pagination.perPage || 20,
          starting_after: pagination.startingAfter || null,
        },
      };
    
      const response = await axios.post(
        `${INTERCOM_API_BASE}/conversations/search`,
        body,
        {
          headers: {
            Authorization: `Bearer ${this.apiKey}`,
            Accept: "application/json",
            "Content-Type": "application/json",
            "Intercom-Version": "2.11",
          },
        }
      );
    
      return response.data as { conversations: IntercomConversation[] };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the search capability and filter parameters but doesn't describe what the search returns (e.g., format, pagination), rate limits, authentication needs, or potential side effects. This leaves significant gaps for a search tool with 6 parameters.

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 a single, efficient sentence that front-loads the core purpose ('Search Intercom conversations') followed by specific filter details. Every word contributes value with no wasted text, making it highly concise and well-structured.

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

Completeness2/5

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

Given the complexity (6 parameters, nested objects, no output schema, and no annotations), the description is incomplete. It doesn't explain the return format, pagination, error handling, or how multiple filters interact. For a search tool with this level of detail in the schema, the description should provide more contextual guidance to compensate for missing structured data.

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 67%, and the description lists the filterable fields (created_at, updated_at, source type, state, open, read), which aligns with the 6 parameters in the schema. However, it doesn't add meaningful semantic context beyond what the schema already provides (e.g., explaining how filters combine or providing examples), so it meets the baseline for moderate 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 action ('Search Intercom conversations') and resource ('conversations'), making the purpose immediately understandable. It distinguishes from the sibling 'list-conversations-from-last-week' by specifying it's a search with filters rather than a time-limited list, though it doesn't explicitly name the alternative.

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

Usage Guidelines3/5

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

The description implies usage context by listing specific filterable attributes (created_at, updated_at, source type, state, open, read), suggesting when to use this tool for filtered searches. However, it doesn't explicitly state when to choose this over 'list-conversations-from-last-week' or provide any exclusions or prerequisites.

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

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/fabian1710/mcp-intercom'

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