Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

Create Contact

create_contact

Add new contacts to your SendGrid email marketing lists by providing email addresses, names, and custom field data for targeted communication.

Instructions

Create new contacts in your SendGrid account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contactsYesArray of contact objects

Implementation Reference

  • The handler function that implements the core logic of the create_contact tool. It checks for read-only mode and performs a PUT request to the SendGrid API to create the provided contacts.
    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) }] };
    },
  • Tool configuration including the input schema, which defines 'contacts' as an array of ContactSchema objects.
    config: {
      title: "Create Contact",
      description: "Create new contacts in your SendGrid account",
      inputSchema: {
        contacts: z.array(ContactSchema).describe("Array of contact objects"),
      },
    },
  • Zod schema defining the structure of a single contact object used in the create_contact tool's input.
    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) and spreads it into the allTools object, aggregating all tools for 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,
    };
  • src/index.ts:20-23 (registration)
    Main server registration loop that registers every tool in allTools, including create_contact, with the MCP server.
    // Register all tools
    for (const [name, tool] of Object.entries(allTools)) {
      server.registerTool(name, tool.config as any, tool.handler as any);
    }
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 specify permissions required, rate limits, whether contacts are immediately available, error handling, or what happens on duplicate emails. This is inadequate for a mutation tool with zero annotation coverage.

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 that states the core purpose without unnecessary words. It's appropriately sized for a tool with one parameter and good schema documentation.

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 explain what happens after creation (e.g., success response format, error conditions), nor does it address behavioral aspects like permissions or constraints. The 100% schema coverage helps but doesn't compensate for missing behavioral context.

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 'contacts' parameter and its nested structure. The description adds no parameter information beyond what's in the schema, maintaining the baseline score of 3 for high schema coverage.

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

Purpose4/5

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

The description clearly states the action ('Create') and resource ('new contacts in your SendGrid account'), making the purpose immediately understandable. However, it doesn't differentiate from sibling 'create_contact_with_lists', which appears to be a more specialized version of contact creation.

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_with_lists' or 'update_contact'. It mentions no prerequisites, constraints, or typical use cases, leaving the agent to infer usage from the 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