Skip to main content
Glama
byndcloud

Unofficial Dex CRM MCP Server

by byndcloud

dex_get_contact

Retrieve a contact's details and timeline entries by ID from Dex CRM, with automatic pagination for notes.

Instructions

Retrieve a single contact by ID. Automatically fetches the contact's notes/timeline entries and includes them in the response under a 'notes' key. Use notesLimit to control how many notes are fetched (default 50). If the contact has more notes than a single page, pagination is handled automatically.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contactIdYes
includeNotesNoFetch and include the contact's notes/timeline entries. Defaults to true.
notesLimitNoMax number of notes to fetch. Defaults to 50. Paginated automatically if above 50.

Implementation Reference

  • The handler function for 'dex_get_contact' that fetches contact data and associated timeline notes.
    async (args) => {
      try {
        const fetchNotes = args.includeNotes !== false;
        const notesLimit = args.notesLimit ?? 50;
        const PAGE_SIZE = 50;
    
        const contactPromise = dex.get<Record<string, unknown>>(
          `/v1/contacts/${args.contactId}`
        );
    
        if (!fetchNotes) {
          return toResult(await contactPromise);
        }
    
        const firstPage = await dex.get<{
          data?: { items?: unknown[]; nextCursor?: string };
        }>("/v1/timeline/", {
          contactId: args.contactId,
          take: String(Math.min(notesLimit, PAGE_SIZE)),
        });
    
        const allItems: unknown[] = firstPage.data?.items ?? [];
        let nextCursor = firstPage.data?.nextCursor;
        let remaining = notesLimit - allItems.length;
    
        while (nextCursor && remaining > 0) {
          const page = await dex.get<{
            data?: { items?: unknown[]; nextCursor?: string };
          }>("/v1/timeline/", {
            contactId: args.contactId,
            take: String(Math.min(remaining, PAGE_SIZE)),
            cursor: nextCursor,
          });
    
          const items = page.data?.items ?? [];
          if (items.length === 0) break;
    
          allItems.push(...items);
          nextCursor = page.data?.nextCursor;
          remaining -= items.length;
        }
    
        const contact = await contactPromise;
        contact.notes = allItems;
    
        return toResult(contact);
      } catch (error) {
  • The tool registration block for 'dex_get_contact' defining its parameters and description.
    server.tool(
      "dex_get_contact",
      "Retrieve a single contact by ID. Automatically fetches the contact's notes/timeline entries " +
        "and includes them in the response under a 'notes' key. Use notesLimit to control how many " +
        "notes are fetched (default 50). If the contact has more notes than a single page, pagination " +
        "is handled automatically.",
      {
        contactId: z.string(),
        includeNotes: z
          .boolean()
          .optional()
          .describe("Fetch and include the contact's notes/timeline entries. Defaults to true."),
        notesLimit: z
          .number()
          .min(1)
          .optional()
          .describe("Max number of notes to fetch. Defaults to 50. Paginated automatically if above 50."),
      },

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/byndcloud/unofficial-dex-mcp'

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