Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

Get Email Statistics by Browser

get_stats_by_browser

Retrieve email statistics grouped by browser type to analyze engagement patterns across different web browsers for SendGrid email campaigns.

Instructions

Retrieve email statistics grouped by browser type

Input Schema

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

Implementation Reference

  • The async handler function that builds the SendGrid API URL for /browsers/stats endpoint and returns the JSON response.
      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) }] };
      },
    },
  • Tool configuration including title, description, and Zod inputSchema for parameter validation.
    config: {
      title: "Get Email Statistics by Browser",
      description: "Retrieve email statistics grouped by browser type",
      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"),
      },
    },
  • Spreads statsTools (containing 'get_stats_by_browser') into allTools, which is imported and registered in MCP server.
    export const allTools = {
      ...automationTools,
      ...campaignTools,
      ...contactTools,
      ...mailTools,
      ...miscTools,
      ...statsTools,
      ...templateTools,
    };
  • src/index.ts:21-23 (registration)
    Registers all tools from allTools object with the MCP server, including get_stats_by_browser.
    for (const [name, tool] of Object.entries(allTools)) {
      server.registerTool(name, tool.config as any, tool.handler as any);
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves statistics but doesn't mention whether this is a read-only operation, what permissions are required, whether there are rate limits, what the return format looks like, or if there's pagination. For a tool with 4 parameters and no annotations, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that gets straight to the point with zero wasted words. It's appropriately sized for a tool with clear parameters in the schema and follows the principle of front-loading the core purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (4 parameters, no annotations, no output schema), the description is insufficient. It doesn't explain what statistics are returned, in what format, or how to interpret the results. For a data retrieval tool with multiple filtering options, more context about the output would be valuable to help the agent understand what to expect.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so all parameters are documented in the schema. The description doesn't add any parameter-specific information beyond what's already in the schema descriptions. It implies date-range filtering and browser grouping but doesn't provide additional context about parameter interactions or usage examples.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Retrieve') and resource ('email statistics grouped by browser type'), making the purpose immediately understandable. It distinguishes from siblings like 'get_stats_by_client_type' or 'get_stats_by_device_type' by specifying 'by browser type'. However, it doesn't explicitly mention what specific statistics are retrieved (e.g., opens, clicks, bounces).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'get_stats_by_client_type' or 'get_global_stats'. The description doesn't mention prerequisites, context, or exclusions. It simply states what the tool does without helping the agent decide when it's appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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