list_templates
Retrieve all email templates from your SendGrid account to manage and reuse them for email campaigns.
Instructions
List all email templates in your SendGrid account
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/index.ts:431-444 (handler)The handler function for the 'list_templates' tool call. It invokes service.listTemplates() and formats the response as a JSON string of template summaries.case 'list_templates': const templates = await service.listTemplates(); return { content: [{ type: 'text', text: JSON.stringify(templates.map(t => ({ id: t.id, name: t.name, generation: t.generation, updated_at: t.updated_at, versions: t.versions.length })), null, 2) }] };
- src/tools/index.ts:221-229 (registration)Registration of the 'list_templates' tool in getToolDefinitions, including name, description, and input schema (empty object).{ name: 'list_templates', description: 'List all email templates in your SendGrid account', inputSchema: { type: 'object', properties: {}, required: [] } },
- src/tools/index.ts:224-228 (schema)Input schema for the 'list_templates' tool: an empty object with no required properties.inputSchema: { type: 'object', properties: {}, required: [] }
- src/services/sendgrid.ts:204-213 (helper)Helper method in SendGridService that fetches the list of dynamic templates from the SendGrid API.async listTemplates(): Promise<SendGridTemplate[]> { const [response] = await this.client.request({ method: 'GET', url: '/v3/templates', qs: { generations: 'dynamic' } }); return ((response.body as { templates: SendGridTemplate[] }).templates || []); }