list_single_sends
Retrieve and view all single send email campaigns from your SendGrid account to monitor campaign performance and manage your email marketing activities.
Instructions
List all single send campaigns
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page_size | No | Number of results to return |
Implementation Reference
- src/tools/campaigns.ts:14-17 (handler)The handler function that fetches and returns the list of single send campaigns from the SendGrid API.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/campaigns.ts:7-13 (schema)Configuration object defining the tool's metadata and input schema for validation using Zod.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"), }, },
- src/tools/index.ts:9-17 (registration)Registration of the campaignTools (containing list_single_sends) into the central allTools export.export const allTools = { ...automationTools, ...campaignTools, ...contactTools, ...mailTools, ...miscTools, ...statsTools, ...templateTools, };
- src/tools/campaigns.ts:5-56 (registration)Export of campaignTools object that defines and registers the list_single_sends tool among other campaign tools.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) }] }; }, }, open_single_send_creator: { config: { title: "Open Single Send Creator", description: "Open SendGrid single send creator in browser", }, handler: async (): Promise<ToolResult> => { return { content: [ { type: "text", text: "Please open this URL in your browser to create a new single send:\nhttps://mc.sendgrid.com/single-sends/new/selector/your-designs?view=raw", }, ], }; }, }, 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`, }, ], }; }, }, };