List Segments
list_segmentsRetrieve all email list segments and their parent list relationships for targeted audience management in SendGrid campaigns.
Instructions
List all segments with their parent list relationships
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/contacts.ts:92-95 (handler)The handler function that fetches all segments from the SendGrid API and returns the JSON response.
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 for the list_segments tool, including title and description. No input schema as the tool requires no parameters.
config: { title: "List Segments", description: "List all segments with their parent list relationships", }, - src/tools/index.ts:12-12 (registration)Includes contactTools (which contains list_segments) in the allTools object export.
...contactTools, - src/index.ts:21-23 (registration)Loop that registers every tool from allTools, including list_segments, with the MCP server.
for (const [name, tool] of Object.entries(allTools)) { server.registerTool(name, tool.config as any, tool.handler as any); }