Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

get_stats_by_browser

Retrieve email statistics grouped by browser type to analyze email campaign performance across different web browsers and optimize email compatibility.

Instructions

Retrieve email statistics grouped by browser type

Input Schema

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

Implementation Reference

  • The core handler function that builds the SendGrid /v3/browsers/stats API URL based on input parameters and fetches the statistics data via makeRequest.
    handler: async ({ start_date, end_date, aggregated_by, browsers }: { start_date: string; end_date?: string; aggregated_by?: string; browsers?: string }): Promise<ToolResult> => { let url = `https://api.sendgrid.com/v3/browsers/stats?start_date=${start_date}`; if (end_date) url += `&end_date=${end_date}`; if (aggregated_by) url += `&aggregated_by=${aggregated_by}`; if (browsers) url += `&browsers=${encodeURIComponent(browsers)}`; const result = await makeRequest(url); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; },
  • Zod input schema defining parameters for the get_stats_by_browser tool: start_date (required), end_date, aggregated_by, browsers.
    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"), browsers: z.string().optional().describe("Comma-separated list of browsers to filter by"), },
  • Aggregates all tool sets including statsTools (which contains get_stats_by_browser) into allTools for top-level registration.
    export const allTools = { ...automationTools, ...campaignTools, ...contactTools, ...mailTools, ...miscTools, ...statsTools, ...templateTools, };
  • src/index.ts:20-23 (registration)
    MCP server registration loop that registers every tool from allTools, including get_stats_by_browser, by name using its config and handler.
    // Register all tools for (const [name, tool] of Object.entries(allTools)) { server.registerTool(name, tool.config as any, tool.handler as any); }

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