create_email_list
Create a new email list in your SendGrid account to organize contacts for targeted email marketing campaigns.
Instructions
Create a new email list in your SendGrid account
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the email list |
Implementation Reference
- src/tools/contacts.ts:29-40 (handler)Handler function that checks read-only mode, makes a POST request to SendGrid API to create the email list with the given name, and returns the JSON response.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)Tool configuration including title, description, and Zod input schema for the 'name' parameter.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)Registers all tools, including 'create_email_list', to the MCP server via a loop over the allTools object.for (const [name, tool] of Object.entries(allTools)) { server.registerTool(name, tool.config as any, tool.handler as any); }
- src/tools/index.ts:9-17 (registration)Aggregates all tool objects from modular files, including contactTools containing 'create_email_list', into a single allTools export.export const allTools = { ...automationTools, ...campaignTools, ...contactTools, ...mailTools, ...miscTools, ...statsTools, ...templateTools, };