Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

list_email_lists

Retrieve all email marketing lists from your SendGrid account to manage contacts, organize subscribers, and create targeted campaigns.

Instructions

List all email lists

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
page_sizeNoNumber of results to return

Implementation Reference

  • Handler function that performs an API request to SendGrid's marketing/lists endpoint to list email lists, with optional page_size parameter, and returns the result as formatted JSON.
    handler: async ({ page_size }: { page_size: number }): Promise<ToolResult> => { const result = await makeRequest(`https://api.sendgrid.com/v3/marketing/lists?page_size=${page_size}`); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; },
  • Tool configuration including title, description, and Zod input schema for the page_size parameter.
    config: { title: "List Email Lists", description: "List all email lists", inputSchema: { page_size: z.number().optional().default(1000).describe("Number of results to return"), }, },
  • src/index.ts:5-23 (registration)
    Final registration of all tools (including list_email_lists) to the MCP server by iterating over allTools and calling server.registerTool.
    import { allTools } from "./tools/index.js"; import { allResources } from "./resources/index.js"; import { allPrompts } from "./prompts/index.js"; import { validateEnvironment, getSafeEnvInfo } from "./shared/env.js"; const server = new McpServer({ name: "sendgrid-mcp", version: "1.0.0", }); // Register all resources for (const [uri, resource] of Object.entries(allResources)) { server.registerResource(uri, uri, resource.config, resource.handler); } // Register all tools for (const [name, tool] of Object.entries(allTools)) { server.registerTool(name, tool.config as any, tool.handler as any); }
  • Import of contactTools and spreading into the allTools object, effectively registering list_email_lists as part of the tools collection.
    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,

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