Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

get_stats_by_mailbox_provider

Retrieve email statistics grouped by mailbox provider to analyze delivery performance across Gmail, Outlook, Yahoo and other email services.

Instructions

Retrieve email statistics grouped by mailbox provider (Gmail, Outlook, Yahoo, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aggregated_byNoHow to group the statisticsday
end_dateNoEnd date in YYYY-MM-DD format (defaults to today)
mailbox_providersNoComma-separated list of mailbox providers to filter by
start_dateYesStart date in YYYY-MM-DD format

Implementation Reference

  • The main handler function for the get_stats_by_mailbox_provider tool. It builds the SendGrid API URL for mailbox providers statistics and fetches the data using makeRequest.
    handler: async ({ start_date, end_date, aggregated_by, mailbox_providers }: { start_date: string; end_date?: string; aggregated_by?: string; mailbox_providers?: string }): Promise<ToolResult> => { let url = `https://api.sendgrid.com/v3/mailbox_providers/stats?start_date=${start_date}`; if (end_date) url += `&end_date=${end_date}`; if (aggregated_by) url += `&aggregated_by=${aggregated_by}`; if (mailbox_providers) url += `&mailbox_providers=${encodeURIComponent(mailbox_providers)}`; const result = await makeRequest(url); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; },
  • The tool configuration including title, description, and Zod inputSchema for validation.
    config: { title: "Get Email Statistics by Mailbox Provider", description: "Retrieve email statistics grouped by mailbox provider (Gmail, Outlook, Yahoo, etc.)", inputSchema: { start_date: z.string().describe("Start date in YYYY-MM-DD format"), end_date: z.string().optional().describe("End date in YYYY-MM-DD format (defaults to today)"), aggregated_by: z.enum(["day", "week", "month"]).optional().default("day").describe("How to group the statistics"), mailbox_providers: z.string().optional().describe("Comma-separated list of mailbox providers to filter by"), }, },
  • src/index.ts:21-23 (registration)
    Registration of all tools (including get_stats_by_mailbox_provider) with the MCP server via a loop over allTools.
    for (const [name, tool] of Object.entries(allTools)) { server.registerTool(name, tool.config as any, tool.handler as any); }
  • Aggregation of all individual tool sets into allTools, including statsTools which contains get_stats_by_mailbox_provider.
    export const allTools = { ...automationTools, ...campaignTools, ...contactTools, ...mailTools, ...miscTools, ...statsTools, ...templateTools, };

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