read_attachment_text
Extract text from email attachments like PDFs and Office documents to analyze content or enable summarization by AI assistants.
Instructions
이메일 첨부파일(pptx, docx, xlsx, pdf, txt)의 텍스트를 추출하여 반환합니다. Claude가 내용을 요약할 수 있도록 텍스트로 변환합니다.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| email_id | Yes | 이메일 ID | |
| filename | Yes | 첨부파일 이름 |
Implementation Reference
- src/attachment-tools.ts:62-81 (handler)Handler for the 'read_attachment_text' tool, which extracts text from an email attachment using 'office-text-extractor'.
case "read_attachment_text": { const tempPath = join(tmpdir(), `email-att-${Date.now()}-${filename}`); await writeFile(tempPath, attachment.content); try { const { getTextExtractor } = await import("office-text-extractor"); const extractor = getTextExtractor(); const text = await extractor.extractText({ input: tempPath, type: "file" }); const truncated = text.length > 30000 ? text.slice(0, 30000) + "\n\n...(30,000자 제한으로 잘림)" : text; return { content: [{ type: "text" as const, text: `**${filename}** 텍스트 내용:\n\n---\n${truncated}`, }], }; } finally { await unlink(tempPath).catch(() => {}); } } - src/attachment-tools.ts:21-32 (schema)Definition and input schema for the 'read_attachment_text' tool.
{ name: "read_attachment_text", description: "이메일 첨부파일(pptx, docx, xlsx, pdf, txt)의 텍스트를 추출하여 반환합니다. Claude가 내용을 요약할 수 있도록 텍스트로 변환합니다.", inputSchema: { type: "object" as const, properties: { email_id: { type: "number", description: "이메일 ID" }, filename: { type: "string", description: "첨부파일 이름" }, }, required: ["email_id", "filename"], }, },