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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/contacts.ts:92-95 (handler)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) }] }; },
- src/tools/contacts.ts:88-91 (schema)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); }
- src/tools/index.ts:12-12 (registration)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";