Skip to content

Commit 5c043e3

Browse files
fatbobmanclaude
andcommitted
docs: update API documentation to reflect simplified read_email output
Changes: - Updated TOOLS.md to reflect new read_email response structure - Removed headers and file_path from response examples - Added cc, references, in_reply_to fields - Updated "What gets extracted" section to clarify only key headers included - Updated read_thread example emails with new field structure - Removed file_path from error handling documentation - Updated ARCHITECTURE.md to document parse_email changes - Added Cc field extraction to data flow example - Added threading headers extraction (References, In-Reply-To) - Updated process steps to reflect 10-step parsing flow - Clarified that output has no raw headers and no file path This aligns documentation with the code simplification that removes unnecessary data (full headers, file paths) and focuses on AI-relevant information for email analysis. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent e151e35 commit 5c043e3

File tree

4 files changed

+29
-30
lines changed

4 files changed

+29
-30
lines changed

ARCHITECTURE.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,11 @@ Mail groups related emails using `conversation_id`:
323323
3. Extract email content until plist XML marker
324324
4. Parse RFC 5322 format using `email` module
325325
5. Decode headers using `email.header.decode_header()`
326-
6. Extract `text/plain` body parts
327-
7. Decode body using charset from `Content-Type`
328-
8. Return structured JSON
326+
6. Extract key headers: Subject, From, To, Cc, Date
327+
7. Extract threading headers: References, In-Reply-To
328+
8. Extract `text/plain` body parts
329+
9. Decode body using charset from `Content-Type`
330+
10. Return structured JSON (no raw headers, no file path)
329331

330332
**Supported Formats**:
331333

@@ -407,7 +409,8 @@ Mail groups related emails using `conversation_id`:
407409
│ ┌──────────────────────────────────────────────────────┐ │
408410
│ │ parse_email.py │ │
409411
│ │ → Read .emlx file │ │
410-
│ │ → Extract Subject, From, To, Date │ │
412+
│ │ → Extract Subject, From, To, Cc, Date │ │
413+
│ │ → Extract threading headers (References, In-Reply-To)│ │
411414
│ │ → Decode body text │ │
412415
│ │ → Return JSON structure │ │
413416
│ └──────────────────────────────────────────────────────┘ │

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
**Demo: See it in action** (Click to watch)
99

10-
[![Demo Video](https://github.com/user-attachments/assets/bd06230b-16ad-476d-8b73-4495071b2b6c)]
10+
![Demo Video](https://github.com/user-attachments/assets/b9229493-8bdf-4995-9ca8-d5de55ec7144)
1111

1212
*Shows: Copy Message-ID from Mail → AI analyzes email content*
1313

README_zh.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
**演示: 实际使用效果** (点击观看)
99

10-
[![演示视频](https://github.com/user-attachments/assets/bd06230b-16ad-476d-8b73-4495071b2b6c)]
10+
![演示视频](https://github.com/user-attachments/assets/b9229493-8bdf-4995-9ca8-d5de55ec7144)
1111

1212
*内容: 从 Mail 复制 Message-ID → AI 分析邮件内容*
1313

TOOLS.md

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -182,18 +182,11 @@ Parse and read plain text content of a single email.
182182
"subject": "Project Update",
183183
"from": "Sender Name <sender@example.com>",
184184
"to": "Recipient Name <recipient@example.com>",
185+
"cc": "cc@example.com",
185186
"date": "Wed, 25 Dec 2024 10:30:00 +0800",
186-
"body_text": "Plain text email body...",
187-
"headers": {
188-
"Message-Id": "<abc@example.com>",
189-
"Subject": "Project Update",
190-
"From": "Sender Name <sender@example.com>",
191-
"To": "Recipient Name <recipient@example.com>",
192-
"Date": "Wed, 25 Dec 2024 10:30:00 +0800",
193-
"Cc": "cc@example.com",
194-
"X-Mailer": "Apple Mail (..."
195-
},
196-
"file_path": "/path/to/email.emlx"
187+
"references": "<original@example.com> <prev@example.com>",
188+
"in_reply_to": "<prev@example.com>",
189+
"body_text": "Plain text email body..."
197190
}
198191
```
199192

@@ -202,8 +195,7 @@ Parse and read plain text content of a single email.
202195
```json
203196
{
204197
"success": false,
205-
"error": "Parse failed: ...",
206-
"file_path": "/path/to/email.emlx"
198+
"error": "Parse failed: ..."
207199
}
208200
```
209201

@@ -219,12 +211,14 @@ Parse and read plain text content of a single email.
219211
**What gets extracted**:
220212

221213
- ✅ Plain text body (`text/plain` parts only)
222-
- ✅ Headers (Subject, From, To, Date, Cc, etc.)
214+
- ✅ Key headers (Subject, From, To, Cc, Date)
215+
- ✅ Threading headers (References, In-Reply-To)
223216
- ✅ Decoded header values (e.g. `=?UTF-8?B?...?=`)
224217
- ❌ Attachments (skipped)
225218
- ❌ HTML content (skipped)
226219
- ❌ Embedded images (skipped)
227220
- ❌ Rich text/RTF (skipped)
221+
- ❌ Full raw headers (not included)
228222

229223
**Email Parsing Process**:
230224

@@ -280,32 +274,35 @@ Parse and read entire email thread.
280274
"subject": "Re: Project Update",
281275
"from": "Alice <alice@example.com>",
282276
"to": "Bob <bob@example.com>",
277+
"cc": "",
283278
"date": "Mon, 23 Dec 2024 09:00:00 +0800",
284-
"body_text": "Hi Bob, how's the project going?",
285-
"headers": {...},
286-
"file_path": "/path/to/msg1.emlx"
279+
"references": "<original@example.com>",
280+
"in_reply_to": "",
281+
"body_text": "Hi Bob, how's the project going?"
287282
},
288283
{
289284
"success": true,
290285
"message_id": "<msg2@example.com>",
291286
"subject": "Re: Project Update",
292287
"from": "Bob <bob@example.com>",
293288
"to": "Alice <alice@example.com>",
289+
"cc": "",
294290
"date": "Tue, 24 Dec 2024 10:30:00 +0800",
295-
"body_text": "Making good progress...",
296-
"headers": {...},
297-
"file_path": "/path/to/msg2.emlx"
291+
"references": "<original@example.com> <msg1@example.com>",
292+
"in_reply_to": "<msg1@example.com>",
293+
"body_text": "Making good progress..."
298294
},
299295
{
300296
"success": true,
301297
"message_id": "<msg3@example.com>",
302298
"subject": "Re: Project Update",
303299
"from": "Alice <alice@example.com>",
304300
"to": "Bob <bob@example.com>",
301+
"cc": "",
305302
"date": "Wed, 25 Dec 2024 15:45:00 +0800",
306-
"body_text": "Great to hear!",
307-
"headers": {...},
308-
"file_path": "/path/to/msg3.emlx"
303+
"references": "<original@example.com> <msg1@example.com> <msg2@example.com>",
304+
"in_reply_to": "<msg2@example.com>",
305+
"body_text": "Great to hear!"
309306
}
310307
]
311308
}
@@ -360,7 +357,6 @@ All tools follow this error response format:
360357
Additional fields may be included depending on the error:
361358

362359
- `message_id` - When Message-ID is provided
363-
- `file_path` - When file operation fails
364360
- `possible_reasons` - Array of likely causes (for `get_email_path`)
365361

366362
### Common Errors

0 commit comments

Comments
 (0)