Skip to main content
Glama
Garoth

SendGrid MCP Server

by Garoth

add_contacts_to_list

Add email addresses to a SendGrid contact list for email marketing campaigns. Specify the list ID and email array to manage subscriber groups.

Instructions

Add contacts to an existing SendGrid list

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
list_idYesID of the contact list
emailsYesArray of email addresses to add to the list

Implementation Reference

  • Core handler function that implements adding contacts to a SendGrid marketing list by updating contacts with the list_ids.
    async addContactsToList(listId: string, contactEmails: string[]) { const [response] = await this.client.request({ method: 'PUT', url: '/v3/marketing/contacts', body: { list_ids: [listId], contacts: contactEmails.map(email => ({ email })) } }); return response; }
  • Input schema defining parameters list_id and emails for the add_contacts_to_list tool.
    inputSchema: { type: 'object', properties: { list_id: { type: 'string', description: 'ID of the contact list' }, emails: { type: 'array', items: { type: 'string' }, description: 'Array of email addresses to add to the list' } }, required: ['list_id', 'emails'] }
  • Tool definition and registration within the getToolDefinitions array.
    { name: 'add_contacts_to_list', description: 'Add contacts to an existing SendGrid list', inputSchema: { type: 'object', properties: { list_id: { type: 'string', description: 'ID of the contact list' }, emails: { type: 'array', items: { type: 'string' }, description: 'Array of email addresses to add to the list' } }, required: ['list_id', 'emails'] } },
  • Dispatcher case in handleToolCall that invokes the service handler and formats the response.
    case 'add_contacts_to_list': await service.addContactsToList(args.list_id, args.emails); return { content: [{ type: 'text', text: `Added ${args.emails.length} contacts to list ${args.list_id}` }] };

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/Garoth/sendgrid-mcp'

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