create_email_list
Create a new email list in your SendGrid account to organize and manage contacts for email marketing campaigns.
Instructions
Create a new email list in your SendGrid account
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the email list |
Input Schema (JSON Schema)
{
"properties": {
"name": {
"description": "Name of the email list",
"type": "string"
}
},
"required": [
"name"
],
"type": "object"
}
Implementation Reference
- src/tools/contacts.ts:29-40 (handler)The handler function that implements the core logic for creating a new email list using SendGrid API, including read-only mode check.handler: async ({ name }: { name: 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/lists", { method: "POST", body: JSON.stringify({ name }), }); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; },
- src/tools/contacts.ts:22-28 (schema)Configuration including title, description, and input schema (Zod validation) for the create_email_list tool.config: { title: "Create Email List", description: "Create a new email list in your SendGrid account", inputSchema: { name: z.string().describe("Name of the email list"), }, },
- src/index.ts:21-23 (registration)MCP server registration loop that registers the create_email_list tool (via allTools) with its config and handler.for (const [name, tool] of Object.entries(allTools)) { server.registerTool(name, tool.config as any, tool.handler as any); }
- src/tools/index.ts:12-12 (registration)Spreading contactTools (which contains create_email_list) into the allTools export for central registration....contactTools,
- src/tools/index.ts:3-3 (registration)Import of contactTools module containing the create_email_list tool definition.import { contactTools } from "./contacts.js";