Skip to main content
Glama
Garoth

SendGrid MCP Server

by Garoth

add_contact

Add email contacts to SendGrid marketing lists for email campaigns and audience management.

Instructions

Add a contact to your SendGrid marketing contacts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailYesContact email address
first_nameNoContact first name (optional)
last_nameNoContact last name (optional)
custom_fieldsNoCustom field values (optional)

Implementation Reference

  • Core handler function in SendGridService that adds a single contact by sending a PUT request to SendGrid's /v3/marketing/contacts endpoint.
    async addContact(contact: SendGridContact) {
      const [response] = await this.client.request({
        method: 'PUT',
        url: '/v3/marketing/contacts',
        body: {
          contacts: [contact]
        }
      });
      return response;
    }
  • Tool call handler case in handleToolCall that invokes the service.addContact method with tool arguments and returns a success response.
    case 'add_contact':
      await service.addContact(args as SendGridContact);
      return { content: [{ type: 'text', text: `Contact ${args.email} added successfully` }] };
  • Registration of the 'add_contact' tool in getToolDefinitions, including name, description, and input schema for MCP tool protocol.
    {
      name: 'add_contact',
      description: 'Add a contact to your SendGrid marketing contacts',
      inputSchema: {
        type: 'object',
        properties: {
          email: {
            type: 'string',
            description: 'Contact email address'
          },
          first_name: {
            type: 'string',
            description: 'Contact first name (optional)'
          },
          last_name: {
            type: 'string',
            description: 'Contact last name (optional)'
          },
          custom_fields: {
            type: 'object',
            description: 'Custom field values (optional)'
          }
        },
        required: ['email']
      }
    },
  • TypeScript interface defining the structure of a SendGridContact, used for type safety in the addContact handler and matching the tool inputSchema.
    export interface SendGridContact {
      id?: string;
      email: string;
      first_name?: string;
      last_name?: string;
      custom_fields?: Record<string, any>;
    }

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