List Custom Fields
list_custom_fieldsRetrieve all custom fields defined in your SendGrid account to manage and organize contact data.
Instructions
List all custom fields
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/contacts.ts:177-186 (handler)The handler function for the list_custom_fields tool, which calls the SendGrid API to retrieve all marketing field definitions and returns the result as JSON.
list_custom_fields: { config: { title: "List Custom Fields", description: "List all custom fields", }, handler: async (): Promise<ToolResult> => { const result = await makeRequest("https://api.sendgrid.com/v3/marketing/field_definitions"); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; }, }, - src/tools/contacts.ts:6-6 (registration)The contactTools export object that contains the list_custom_fields definition, which is spread into allTools in src/tools/index.ts.
export const contactTools = { - src/tools/index.ts:9-17 (registration)The allTools object that aggregates all tool modules including contactTools (which contains list_custom_fields). This is what gets registered in the MCP server.
export const allTools = { ...automationTools, ...campaignTools, ...contactTools, ...mailTools, ...miscTools, ...statsTools, ...templateTools, }; - src/index.ts:20-23 (registration)The MCP server registration loop that registers each tool (including list_custom_fields) with the server via server.registerTool().
// Register all tools for (const [name, tool] of Object.entries(allTools)) { server.registerTool(name, tool.config as any, tool.handler as any); }