Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

Update Contact

update_contact

Modify existing contact details in SendGrid, including email, name, address, phone, and custom fields to maintain accurate subscriber information.

Instructions

Update existing contact information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contactsYesArray of contact objects with updates

Implementation Reference

  • Handler function for update_contact tool. Checks read-only mode, then sends a PUT request to SendGrid's /marketing/contacts endpoint with the updated contacts array.
    handler: async ({ contacts }: { contacts: any[] }): Promise<ToolResult> => {
      const readOnlyCheck = checkReadOnlyMode();
      if (readOnlyCheck.blocked) {
        return { content: [{ type: "text", text: readOnlyCheck.message! }] };
      }
      
      const result = await makeRequest("https://api.sendgrid.com/v3/marketing/contacts", {
        method: "PUT",
        body: JSON.stringify({ contacts }),
      });
      return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
    },
  • Zod input schema for update_contact tool, defining the structure of contacts array with optional fields for updating contact information.
    inputSchema: {
      contacts: z.array(
        z.object({
          id: z.string().describe("Contact ID (required for updates)"),
          email: z.string().email().optional().describe("Email address"),
          first_name: z.string().optional().describe("First name"),
          last_name: z.string().optional().describe("Last name"),
          phone_number: z.string().optional().describe("Phone number"),
          address_line_1: z.string().optional().describe("Address line 1"),
          address_line_2: z.string().optional().describe("Address line 2"),
          city: z.string().optional().describe("City"),
          state_province_region: z.string().optional().describe("State/Province/Region"),
          postal_code: z.string().optional().describe("Postal code"),
          country: z.string().optional().describe("Country"),
          custom_fields: z.record(z.any()).optional().describe("Custom field values"),
        })
      ).describe("Array of contact objects with updates"),
    },
  • Definition and registration of the update_contact tool within the contactTools object.
    update_contact: {
      config: {
        title: "Update Contact",
        description: "Update existing contact information",
        inputSchema: {
          contacts: z.array(
            z.object({
              id: z.string().describe("Contact ID (required for updates)"),
              email: z.string().email().optional().describe("Email address"),
              first_name: z.string().optional().describe("First name"),
              last_name: z.string().optional().describe("Last name"),
              phone_number: z.string().optional().describe("Phone number"),
              address_line_1: z.string().optional().describe("Address line 1"),
              address_line_2: z.string().optional().describe("Address line 2"),
              city: z.string().optional().describe("City"),
              state_province_region: z.string().optional().describe("State/Province/Region"),
              postal_code: z.string().optional().describe("Postal code"),
              country: z.string().optional().describe("Country"),
              custom_fields: z.record(z.any()).optional().describe("Custom field values"),
            })
          ).describe("Array of contact objects with updates"),
        },
      },
      handler: async ({ contacts }: { contacts: any[] }): Promise<ToolResult> => {
        const readOnlyCheck = checkReadOnlyMode();
        if (readOnlyCheck.blocked) {
          return { content: [{ type: "text", text: readOnlyCheck.message! }] };
        }
        
        const result = await makeRequest("https://api.sendgrid.com/v3/marketing/contacts", {
          method: "PUT",
          body: JSON.stringify({ contacts }),
        });
        return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
      },
    },
  • Registration of contactTools (including update_contact) into the allTools object exported for use in MCP.
    export const allTools = {
      ...automationTools,
      ...campaignTools,
      ...contactTools,
      ...mailTools,
      ...miscTools,
      ...statsTools,
      ...templateTools,
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only states it's an update operation without disclosing behavioral traits like whether it requires specific permissions, if updates are partial or complete, what happens to unspecified fields, error handling, or rate limits. 'Update existing contact information' implies mutation but lacks crucial details for safe invocation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's appropriately sized and front-loaded, making it easy to parse quickly without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't address return values, error conditions, or behavioral nuances needed for safe use. Given the complexity of updating contacts with multiple fields, more context is warranted beyond the basic statement.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents the single parameter (contacts array with nested objects). The description adds no meaning beyond what the schema provides—it doesn't explain parameter relationships, constraints, or usage patterns. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Update existing contact information' clearly states the verb (update) and resource (contact information), but it's vague about scope and doesn't distinguish from sibling tools like update_custom_field or update_email_list. It's adequate but lacks specificity about what aspects of contact information can be updated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided about when to use this tool versus alternatives like update_custom_field or update_email_list, nor about prerequisites (e.g., needing contact ID). The description assumes context but offers no explicit usage instructions or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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