Skip to main content
Glama

updateContact

Modify an existing contact's details in Omnisend by applying specific changes to the contact's stored information.

Instructions

Update an existing contact's information. IMPORTANT: You must first get the contact using getContact and preserve the returned structure when updating. The update request requires the same structure as returned by the GET method, with only your desired changes applied.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the updateContact tool. It calls the underlying updateContact API function with contactId and contactData, filters the response using filterContactFields, and returns the JSON stringified result or error message.
    async (args) => { try { const response = await updateContact(args.contactId, args.contactData); // 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" }] }; } }
  • Input schema for the updateContact tool, defining parameters contactId (string) and contactData (object).
    { additionalProperties: false, properties: { contactId: { description: "Contact ID", type: "string" }, contactData: { additionalProperties: true, description: "Contact data in the same structure as returned by getContact", properties: {}, type: "object" } }, required: ["contactId", "contactData"], type: "object"
  • Registration of the updateContact tool on the MCP server, including the tool name, description, input schema, and handler function.
    server.tool( "updateContact", "Update an existing contact's information. IMPORTANT: You must first get the contact using getContact and preserve the returned structure when updating. The update request requires the same structure as returned by the GET method, with only your desired changes applied.", { additionalProperties: false, properties: { contactId: { description: "Contact ID", type: "string" }, contactData: { additionalProperties: true, description: "Contact data in the same structure as returned by getContact", properties: {}, type: "object" } }, required: ["contactId", "contactData"], type: "object" }, async (args) => { try { const response = await updateContact(args.contactId, args.contactData); // 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 that makes the PATCH API call to Omnisend to update a specific contact by ID.
    export const updateContact = async (contactId: string, contactData: Partial<Contact>): Promise<Contact> => { try { const response = await omnisendApi.patch<Contact>(`/contacts/${contactId}`, contactData); return response.data; } catch (error) { if (error instanceof Error) { throw new Error(`Error updating contact: ${error.message}`); } else { throw new Error('Unknown error occurred when updating contact'); } } };

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