Open Single Send Stats
open_single_send_statsOpen the statistics page for a single send campaign to analyze its performance.
Instructions
Open single send stats page for a specific campaign
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| singlesend_id | Yes | The single send ID to view stats for |
Implementation Reference
- src/tools/campaigns.ts:37-55 (handler)The handler function for the open_single_send_stats tool. It takes a singlesend_id parameter and returns a URL to view stats for that single send campaign in SendGrid's web interface.
open_single_send_stats: { config: { title: "Open Single Send Stats", description: "Open single send stats page for a specific campaign", inputSchema: { singlesend_id: z.string().describe("The single send ID to view stats for"), }, }, handler: async ({ singlesend_id }: { singlesend_id: string }): Promise<ToolResult> => { return { content: [ { type: "text", text: `Please open this URL in your browser to view stats for single send ${singlesend_id}:\nhttps://mc.sendgrid.com/single-sends/${singlesend_id}/stats?view=raw`, }, ], }; }, }, - src/tools/campaigns.ts:38-44 (schema)The input schema for open_single_send_stats, defining the singlesend_id parameter (required string).
config: { title: "Open Single Send Stats", description: "Open single send stats page for a specific campaign", inputSchema: { singlesend_id: z.string().describe("The single send ID to view stats for"), }, }, - src/index.ts:20-23 (registration)Registration of all tools (including open_single_send_stats) from allTools into the MCP server via server.registerTool().
// Register all tools for (const [name, tool] of Object.entries(allTools)) { server.registerTool(name, tool.config as any, tool.handler as any); } - src/tools/campaigns.ts:5-18 (helper)The campaignTools object that contains open_single_send_stats alongside other campaign-related tools. This is exported and merged into allTools.
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) }] }; }, }, - src/tools/index.ts:9-17 (helper)The allTools object which aggregates all tool objects from different modules, including campaignTools.
export const allTools = { ...automationTools, ...campaignTools, ...contactTools, ...mailTools, ...miscTools, ...statsTools, ...templateTools, };