Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

Create Contact with Lists

create_contact_with_lists

Add new email contacts to specific SendGrid mailing lists for targeted email marketing campaigns.

Instructions

Create new contacts and assign them to specific email lists

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contactsYesArray of contact objects
list_idsYesArray of list IDs to add the contact to

Implementation Reference

  • The handler function that executes the tool: checks read-only mode, sends PUT request to SendGrid API to create contacts and assign to specified lists, returns the API response.
    handler: async ({ contacts, list_ids }: { contacts: any[]; list_ids: string[] }): 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, list_ids }),
      });
      return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
    },
  • Tool configuration including title, description, and input schema using Zod for validation.
    config: {
      title: "Create Contact with Lists",
      description: "Create new contacts and assign them to specific email lists",
      inputSchema: {
        contacts: z.array(ContactSchema).describe("Array of contact objects"),
        list_ids: z.array(z.string()).describe("Array of list IDs to add the contact to"),
      },
    },
  • Zod schema for individual contact objects referenced in the tool's input schema.
    export const ContactSchema = z.object({
      email: z.string().describe("Contact email address"),
      first_name: z.string().optional().describe("First name"),
      last_name: z.string().optional().describe("Last name"),
      custom_fields: z.record(z.any()).optional().describe("Custom field values"),
    });
  • Imports contactTools (containing create_contact_with_lists) and spreads it into the allTools object for global tool registration.
    import { contactTools } from "./contacts.js";
    import { mailTools } from "./mail.js";
    import { miscTools } from "./misc.js";
    import { statsTools } from "./stats.js";
    import { templateTools } from "./templates.js";
    
    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 for behavioral disclosure. While 'Create' implies a write operation, it doesn't address permissions needed, whether contacts are created if they already exist, error handling, rate limits, or what happens when list_ids are invalid. This is inadequate for a mutation tool.

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 perfectly concise - one sentence with zero wasted words. It's front-loaded with the core functionality and uses clear, direct language. Every word earns its place in communicating the essential purpose.

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 insufficient. It doesn't cover behavioral aspects like side effects, error conditions, or response format. While concise, it leaves too many operational questions unanswered for safe agent invocation.

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 both parameters. The description adds no additional parameter semantics beyond what's in the schema - it doesn't explain format expectations, constraints, or relationships between contacts and list_ids. Baseline 3 is appropriate when schema does all the work.

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

Purpose5/5

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

The description clearly states the specific action ('Create new contacts') and resource ('assign them to specific email lists'), distinguishing it from sibling tools like 'create_contact' which lacks list assignment. It precisely defines the tool's unique functionality in one concise sentence.

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?

The description provides no guidance on when to use this tool versus alternatives like 'create_contact' or 'update_contact'. It doesn't mention prerequisites, constraints, or typical use cases, leaving the agent to infer usage from the tool name alone.

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