Skip to main content
Glama

getContact

Retrieve detailed contact information using a unique identifier to enhance personalization and management within the Omnisend marketing platform.

Instructions

Retrieve detailed information about a specific contact by their unique identifier.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contactIdYesContact ID

Implementation Reference

  • MCP tool registration for 'getContact', including description, input schema, and inline handler function that calls API and returns filtered JSON.
    server.tool( "getContact", "Retrieve detailed information about a specific contact by their unique identifier.", { additionalProperties: false, properties: { contactId: { description: "Contact ID", type: "string" } }, required: ["contactId"], type: "object" }, async (args) => { try { const response = await getContact(args.contactId); // Filter contact data to include only defined fields const filteredContact = filterContactFields(response); return { content: [ { type: "text", text: JSON.stringify(filteredContact, 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" }] }; } } );
  • API handler function that performs the HTTP GET request to retrieve specific contact data from Omnisend API.
    export const getContact = async (contactId: string): Promise<Contact> => { try { const response = await omnisendApi.get<Contact>(`/contacts/${contactId}`); return response.data; } catch (error) { if (error instanceof Error) { throw new Error(`Error getting contact information: ${error.message}`); } else { throw new Error('Unknown error occurred when getting contact'); } }
  • Helper function to filter and select specific fields from the raw contact object for safe exposure.
    export const filterContactFields = (contact: any) => { return { contactID: contact.contactID, email: contact.email, phone: contact.phone, firstName: contact.firstName, lastName: contact.lastName, status: contact.status, tags: contact.tags, identifiers: contact.identifiers, createdAt: contact.createdAt, updatedAt: contact.updatedAt, // Include added fields country: contact.country, state: contact.state, city: contact.city, gender: contact.gender, birthdate: contact.birthdate }; };

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

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