Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

list_contacts

Retrieve all contacts from your SendGrid account with pagination support to manage large contact lists efficiently.

Instructions

List all contacts with optional pagination

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
page_sizeNoNumber of contacts to return (max 1000)
page_tokenNoToken for pagination

Implementation Reference

  • The handler function that executes the list_contacts tool logic by fetching paginated contacts from the SendGrid Marketing API.
    handler: async ({ page_size, page_token }: { page_size?: number; page_token?: string }): Promise<ToolResult> => { let url = `https://api.sendgrid.com/v3/marketing/contacts?page_size=${page_size || 100}`; if (page_token) url += `&page_token=${page_token}`; const result = await makeRequest(url); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; },
  • The tool configuration object defining title, description, and Zod input schema for pagination parameters.
    config: { title: "List All Contacts", description: "List all contacts with optional pagination", inputSchema: { page_size: z.number().optional().default(100).describe("Number of contacts to return (max 1000)"), page_token: z.string().optional().describe("Token for pagination"), }, },
  • src/index.ts:21-23 (registration)
    Dynamic registration loop that calls server.registerTool for every tool in allTools, including 'list_contacts'.
    for (const [name, tool] of Object.entries(allTools)) { server.registerTool(name, tool.config as any, tool.handler as any); }

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