list_emails
Retrieve marketing emails from HubSpot with options to limit results, apply offsets, and sort by date or name for efficient email management.
Instructions
HubSpotのマーケティングメール一覧を取得
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | 取得件数(デフォルト: 20) | |
| offset | No | オフセット(デフォルト: 0) | |
| sort | No | ソート項目 (name, createdAt, updatedAt, createdBy, updatedBy)。降順は -createdAt のように - を付ける |
Implementation Reference
- src/hubspot/client.ts:28-34 (handler)The core implementation of listEmails method that constructs the HubSpot API request URL with query parameters (limit, offset, sort) and makes the HTTP GET request to /marketing/v3/emails endpointasync listEmails(limit = 20, offset = 0, sort?: string) { let url = `/marketing/v3/emails?limit=${limit}&offset=${offset}`; if (sort) { url += `&sort=${encodeURIComponent(sort)}`; } return this.request(url); }
- src/tools/types.ts:3-7 (schema)Zod schema definition for list_emails tool input validation, defining optional parameters: limit (default 20), offset (default 0), and sort with Japanese descriptionexport const ListEmailsSchema = z.object({ limit: z.number().optional().default(20), offset: z.number().optional().default(0), sort: z.string().optional().describe('ソート項目 (name, createdAt, updatedAt, createdBy, updatedBy)。降順は -createdAt のように - を付ける'), });
- src/server.ts:41-51 (registration)MCP tool registration for list_emails, defining the tool name, description in Japanese, and input schema with properties for limit, offset, and sort parametersname: 'list_emails', description: 'HubSpotのマーケティングメール一覧を取得', inputSchema: { type: 'object', properties: { limit: { type: 'number', description: '取得件数(デフォルト: 20)' }, offset: { type: 'number', description: 'オフセット(デフォルト: 0)' }, sort: { type: 'string', description: 'ソート項目 (name, createdAt, updatedAt, createdBy, updatedBy)。降順は -createdAt のように - を付ける' }, }, }, },
- src/server.ts:102-108 (handler)MCP request handler for list_emails tool that validates input arguments using ListEmailsSchema, calls the HubSpot client's listEmails method, and returns the formatted JSON responsecase 'list_emails': { const args = ListEmailsSchema.parse(request.params.arguments); const result = await this.hubspot.listEmails(args.limit, args.offset, args.sort); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }