Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

Get Global Email Statistics

get_global_stats

Retrieve global email statistics from your SendGrid account to analyze performance metrics within specified date ranges.

Instructions

Retrieve global email statistics for your SendGrid account

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

Implementation Reference

  • The main handler function that implements the logic for the get_global_stats tool by constructing the SendGrid API URL and calling makeRequest to fetch global email statistics.
    handler: async ({ start_date, end_date, aggregated_by }: { start_date: string; end_date?: string; aggregated_by?: string }): Promise<ToolResult> => {
      let url = `https://api.sendgrid.com/v3/stats?start_date=${start_date}`;
      if (end_date) url += `&end_date=${end_date}`;
      if (aggregated_by) url += `&aggregated_by=${aggregated_by}`;
      
      const result = await makeRequest(url);
      return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
    },
  • Zod schema for input validation of the get_global_stats tool parameters.
    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"),
    },
  • src/index.ts:21-23 (registration)
    The MCP server registration loop that registers the get_global_stats tool (along with all other tools from allTools).
    for (const [name, tool] of Object.entries(allTools)) {
      server.registerTool(name, tool.config as any, tool.handler as any);
    }
  • Spreads the statsTools object (containing get_global_stats) into the allTools export used for registration.
    ...statsTools,
  • Full definition of the get_global_stats tool within the statsTools export, including config and handler.
    get_global_stats: {
      config: {
        title: "Get Global Email Statistics",
        description: "Retrieve global email statistics for your SendGrid account",
        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"),
        },
      },
      handler: async ({ start_date, end_date, aggregated_by }: { start_date: string; end_date?: string; aggregated_by?: string }): Promise<ToolResult> => {
        let url = `https://api.sendgrid.com/v3/stats?start_date=${start_date}`;
        if (end_date) url += `&end_date=${end_date}`;
        if (aggregated_by) url += `&aggregated_by=${aggregated_by}`;
        
        const result = await makeRequest(url);
        return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
      },
    },
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'Retrieve' implies a read operation, the description doesn't mention authentication requirements, rate limits, data freshness, or what format the statistics are returned in. For a statistics retrieval tool with zero annotation coverage, this leaves significant behavioral questions unanswered.

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 immediately communicates the core purpose without any wasted words. It's appropriately sized for a straightforward retrieval tool and front-loads the essential information.

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

Completeness3/5

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

For a read-only statistics tool with good schema coverage but no annotations and no output schema, the description is minimally adequate. It states what the tool does but lacks important context about when to use it versus sibling tools and what behavioral characteristics to expect. The absence of output schema means the description should ideally hint at return format, but it doesn't.

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?

Schema description coverage is 100%, so the schema already fully documents all three parameters. The description doesn't add any parameter-specific information beyond what's in the schema. The baseline score of 3 reflects adequate but minimal value addition when the schema does the heavy lifting.

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 action ('Retrieve') and resource ('global email statistics for your SendGrid account'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_category_stats' or 'get_stats_overview', which appear to be related statistics tools in the same domain.

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?

The description provides no guidance on when to use this tool versus alternatives. With multiple statistics-related sibling tools (get_category_stats, get_stats_by_browser, get_stats_overview, etc.), there's no indication of what makes 'global' statistics distinct or when this specific tool should be selected over other stats tools.

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