Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

list_segments

Retrieve all email segments along with their parent list relationships to organize and manage targeted audience groups for email marketing campaigns.

Instructions

List all segments with their parent list relationships

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the list_segments tool logic by calling the SendGrid API to list segments and returning the result as formatted JSON.
    handler: async (): Promise<ToolResult> => { const result = await makeRequest("https://api.sendgrid.com/v3/marketing/segments"); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; },
  • Configuration schema for the list_segments tool, defining its title and description. No input parameters required.
    config: { title: "List Segments", description: "List all segments with their parent list relationships", },
  • src/index.ts:21-23 (registration)
    Registration loop that adds the list_segments tool (along with all others from allTools) to the MCP server.
    for (const [name, tool] of Object.entries(allTools)) { server.registerTool(name, tool.config as any, tool.handler as any); }
  • Spreads contactTools (containing list_segments) into allTools export.
    ...contactTools,
  • src/tools/index.ts:3-3 (registration)
    Imports contactTools which defines the list_segments tool.
    import { contactTools } from "./contacts.js";

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