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のマーケティングメール一覧を取得
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_emails"
}
}Input 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 endpoint
async 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 description
export 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 parameters
name: '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 response
case '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) }], }; }