fetch_recent_emails
Retrieve recent email bodies in batches for summarization or schedule extraction. Specify count to fetch up to 10 emails.
Instructions
최근 N개 이메일의 전체 본문을 배치로 가져옵니다. 요약/일정 추출 시 사용하세요.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | 가져올 이메일 수 (기본: 5, 최대: 10) |
Implementation Reference
- src/email-tools.ts:131-159 (handler)The handler implementation for the "fetch_recent_emails" tool. It connects to the POP3 server, fetches the requested number of recent emails, processes their body text with size limiting, and formats the output.
case "fetch_recent_emails": { const count = Math.min((args.count as number) || 5, 10); const emails = await withConnection(config, async (client) => { const total = await client.getMessageCount(); const results = []; for (let i = total; i > Math.max(0, total - count); i--) { try { results.push(await client.getEmail(i)); } catch { /* skip */ } } return results; }); const text = emails .map((e) => { const body = e.body.length > 20000 ? e.body.slice(0, 20000) + "\n...(20,000자 제한)" : e.body; return ( `## ${e.subject}\n` + `From: ${e.from} | ${e.date ? new Date(e.date).toLocaleString("ko-KR") : ""}\n` + `${e.attachments.length > 0 ? `첨부: ${e.attachments.map((a) => a.filename).join(", ")}\n` : ""}` + `\n${body}` ); }) .join("\n\n---\n\n"); return { content: [{ type: "text" as const, text }] }; } - src/email-tools.ts:43-51 (schema)The MCP tool schema definition for "fetch_recent_emails", including its description and input validation schema.
name: "fetch_recent_emails", description: "최근 N개 이메일의 전체 본문을 배치로 가져옵니다. 요약/일정 추출 시 사용하세요.", inputSchema: { type: "object" as const, properties: { count: { type: "number", description: "가져올 이메일 수 (기본: 5, 최대: 10)" }, }, }, },