Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

List Single Send Campaigns

list_single_sends

Retrieve all single send campaigns from your SendGrid account. Specify the number of results to return per page.

Instructions

List all single send campaigns

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
page_sizeNoNumber of results to return

Implementation Reference

  • The main handler, config (schema), and definition for the 'list_single_sends' tool. It accepts an optional page_size parameter (default 50), calls the SendGrid API endpoint POST /v3/marketing/singlesends/search, and returns the JSON result.
    import { z } from "zod";
    import { makeRequest } from "../shared/api.js";
    import { ToolResult } from "../shared/types.js";
    
    export const campaignTools = {
      list_single_sends: {
        config: {
          title: "List Single Send Campaigns",
          description: "List all single send campaigns",
          inputSchema: {
            page_size: z.number().optional().default(50).describe("Number of results to return"),
          },
        },
        handler: async ({ page_size }: { page_size: number }): Promise<ToolResult> => {
          const result = await makeRequest(`https://api.sendgrid.com/v3/marketing/singlesends/search?page_size=${page_size}`);
          return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
        },
      },
  • The tool is registered by spreading 'campaignTools' (which contains list_single_sends) into the 'allTools' export, making it available to the MCP server.
    import { automationTools } from "./automations.js";
    import { campaignTools } from "./campaigns.js";
    import { contactTools } from "./contacts.js";
    import { mailTools } from "./mail.js";
    import { miscTools } from "./misc.js";
    import { statsTools } from "./stats.js";
    import { templateTools } from "./templates.js";
    
    export const allTools = {
      ...automationTools,
      ...campaignTools,
      ...contactTools,
      ...mailTools,
      ...miscTools,
      ...statsTools,
      ...templateTools,
    };
  • Help text documentation referencing the 'list_single_sends' tool in the campaign help prompt, describing it as 'View all your single send campaigns'.
    Available single send tools:
    - list_single_sends: View all your single send campaigns
    - open_single_send_creator: Open the SendGrid web interface to create a new campaign
  • The 'makeRequest' helper function used by the handler to execute the HTTP request to the SendGrid API.
    import { getAuthHeaders } from "./auth.js";
    
    export async function makeRequest(url: string, options: RequestInit = {}): Promise<any> {
      const response = await fetch(url, {
        headers: {
          ...getAuthHeaders(),
          ...options.headers,
        },
        ...options,
      });
    
      if (!response.ok) {
        const errorText = await response.text();
        throw new Error(`SendGrid API error (${response.status}): ${errorText}`);
      }
    
      return response.json();
  • The ToolResult interface definition used as the return type of the handler.
    export interface ToolResult {
      content: Array<{
        type: "text";
        text: string;
      }>;
    }
Behavior2/5

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

Annotations are absent, so the description is the sole source of behavioral info. It implies a safe read operation but does not explicitly state non-destructiveness, required permissions, or response format. No details about pagination or result limits beyond the parameter.

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

Conciseness4/5

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

The description is a single, clear sentence without wasted words. However, it could be slightly expanded to include basic context like pagination or result format without losing conciseness.

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?

Given the tool's simplicity (one optional parameter, no output schema), the description is minimally adequate but lacks explanation of what the response contains or how pagination works. It could be more informative for completeness.

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 coverage is 100% with parameter 'page_size' described as 'Number of results to return'. The description adds no additional meaning to the parameter, meeting the baseline for full schema coverage.

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

Purpose5/5

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

The description 'List all single send campaigns' clearly states the action (List) and the resource (single send campaigns). It distinguishes from sibling tools like open_single_send_creator and open_single_send_stats which are for creation and stats, respectively.

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 on when to use this tool versus alternatives. It does not mention that this is for reading existing campaigns, nor does it contrast with related tools like open_single_send_creator or open_single_send_stats.

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