Skip to main content
Glama

getContact

Retrieve detailed contact information from the Omnisend marketing platform using a unique identifier to access customer data for management and tracking purposes.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the logic for the 'getContact' MCP tool. It calls the API helper, filters the contact data, formats it as JSON, and handles errors by returning text content.
    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" }] }; } }
  • JSON Schema defining the input parameters for the getContact tool, which requires a single 'contactId' string.
    { additionalProperties: false, properties: { contactId: { description: "Contact ID", type: "string" } }, required: ["contactId"], type: "object"
  • The server.tool call that registers the 'getContact' tool on the MCP server, including the tool name, description, input schema, and handler function.
    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" }] }; } } );
  • Helper function from api-resources that performs the actual Omnisend API GET request to fetch a contact by ID and returns the Contact object.
    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 utility function that filters and selects specific fields from the raw contact data for safe exposure in tool responses.
    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 }; };

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