Skip to main content
Glama

listContacts

Retrieve contact lists from Omnisend with pagination support, including email and phone identifiers across multiple channels.

Instructions

Retrieve a list of contacts from Omnisend. Each contact can be identified by multiple identifiers (email, phone) with corresponding channels. The response includes pagination information (next/previous cursor, limit, offset).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for listContacts: calls API helper, filters results, formats as JSON text content with error handling.
    async (args) => { try { const response = await listContacts(args); // Filter contacts data to include only defined fields const filteredContacts = response.contacts.map(filterContactFields); return { content: [ { type: "text", text: JSON.stringify({ contacts: filteredContacts, paging: response.paging }, null, 2) } ] }; } catch (error) { if (error instanceof Error) { return { content: [{ type: "text", text: `Error: ${error.message}` }] }; } return { content: [{ type: "text", text: "An unknown error occurred" }] }; } }
  • JSON Schema for listContacts tool input parameters.
    { additionalProperties: false, properties: { limit: { description: "Maximum number of contacts to return", type: "number" }, offset: { description: "Skip first N results", type: "number" }, email: { description: "Filter contacts by email address", type: "string" }, phone: { description: "Filter contacts by phone number", type: "string" }, status: { description: "Filter contacts by subscription status", enum: ["subscribed", "unsubscribed", "nonSubscribed"], type: "string" }, createdAfter: { description: "Filter contacts created after specified date (ISO format)", type: "string" }, updatedAfter: { description: "Filter contacts updated after specified date (ISO format)", type: "string" }, tags: { description: "Filter contacts by tags", items: { type: "string" }, type: "array" } }, type: "object" },
  • Tool registration call for listContacts using McpServer.tool() with name, description, schema, and handler.
    server.tool( "listContacts", "Retrieve a list of contacts from Omnisend. Each contact can be identified by multiple identifiers (email, phone) with corresponding channels. The response includes pagination information (next/previous cursor, limit, offset).", { additionalProperties: false, properties: { limit: { description: "Maximum number of contacts to return", type: "number" }, offset: { description: "Skip first N results", type: "number" }, email: { description: "Filter contacts by email address", type: "string" }, phone: { description: "Filter contacts by phone number", type: "string" }, status: { description: "Filter contacts by subscription status", enum: ["subscribed", "unsubscribed", "nonSubscribed"], type: "string" }, createdAfter: { description: "Filter contacts created after specified date (ISO format)", type: "string" }, updatedAfter: { description: "Filter contacts updated after specified date (ISO format)", type: "string" }, tags: { description: "Filter contacts by tags", items: { type: "string" }, type: "array" } }, type: "object" }, async (args) => { try { const response = await listContacts(args); // Filter contacts data to include only defined fields const filteredContacts = response.contacts.map(filterContactFields); return { content: [ { type: "text", text: JSON.stringify({ contacts: filteredContacts, paging: response.paging }, null, 2) } ] }; } catch (error) { if (error instanceof Error) { return { content: [{ type: "text", text: `Error: ${error.message}` }] }; } return { content: [{ type: "text", text: "An unknown error occurred" }] }; } } );
  • Helper function that performs the actual API call to Omnisend /contacts endpoint.
    export const listContacts = async (params: ListContactsParams = {}): Promise<ContactsResponse> => { try { // Pridėkime trumpą užlaikymą, kad išvengtume daug užklausų per trumpą laiką const response = await omnisendApi.get<ContactsResponse>('/contacts', { params }); return response.data; } catch (error) { // Pagerinkime klaidos apdorojimą if (error instanceof Error) { throw new Error(`Error getting contacts list: ${error.message}`); } else { throw new Error('Unknown error occurred when getting contacts list'); } } };
  • TypeScript interface defining parameters for listContacts, matching the tool schema.
    export interface ListContactsParams { limit?: number; offset?: number; status?: 'subscribed' | 'unsubscribed' | 'nonSubscribed'; }

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/plutzilla/omnisend-mcp'

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