Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

list_custom_fields

Retrieve all custom fields defined in your SendGrid account to organize and segment contact data for targeted email campaigns.

Instructions

List all custom fields

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'list_custom_fields' tool. It makes an API request to SendGrid's marketing/field_definitions endpoint and returns the result as formatted JSON.
    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) }] }; },
  • The configuration object defining the tool's title and description, used for schema generation in MCP.
    config: { title: "List Custom Fields", description: "List all custom fields", },
  • src/index.ts:21-23 (registration)
    The registration code in the main MCP server file that registers all tools, including 'list_custom_fields', by iterating over allTools and calling registerTool.
    for (const [name, tool] of Object.entries(allTools)) { server.registerTool(name, tool.config as any, tool.handler as any); }
  • Spreading of contactTools into allTools, making 'list_custom_fields' available for registration.
    ...contactTools,
  • Export of contactTools object containing the 'list_custom_fields' tool definition.
    export const contactTools = {

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