Files
mail-intake/mcp_docs/modules/mail_intake.parsers.headers.json
Vishesh 'ironeagle' Bangotra f7f9744e47 docs-and-mcps (#1)
Reviewed-on: #1
Co-authored-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com>
Co-committed-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com>
2026-01-22 11:28:23 +00:00

51 lines
3.3 KiB
JSON

{
"module": "mail_intake.parsers.headers",
"content": {
"path": "mail_intake.parsers.headers",
"docstring": "Message header parsing utilities for Mail Intake.\n\nThis module provides helper functions for normalizing and extracting\nuseful information from provider-native message headers.\n\nThe functions here are intentionally simple and tolerant of malformed\nor incomplete header data.",
"objects": {
"Dict": {
"name": "Dict",
"kind": "alias",
"path": "mail_intake.parsers.headers.Dict",
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
"docstring": null
},
"List": {
"name": "List",
"kind": "alias",
"path": "mail_intake.parsers.headers.List",
"signature": "<bound method Alias.signature of Alias('List', 'typing.List')>",
"docstring": null
},
"Tuple": {
"name": "Tuple",
"kind": "alias",
"path": "mail_intake.parsers.headers.Tuple",
"signature": "<bound method Alias.signature of Alias('Tuple', 'typing.Tuple')>",
"docstring": null
},
"Optional": {
"name": "Optional",
"kind": "alias",
"path": "mail_intake.parsers.headers.Optional",
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
"docstring": null
},
"parse_headers": {
"name": "parse_headers",
"kind": "function",
"path": "mail_intake.parsers.headers.parse_headers",
"signature": "<bound method Function.signature of Function('parse_headers', 14, 53)>",
"docstring": "Convert a list of Gmail-style headers into a normalized dict.\n\nProvider payloads (such as Gmail) typically represent headers as a list\nof name/value mappings. This function normalizes them into a\ncase-insensitive dictionary keyed by lowercase header names.\n\nArgs:\n raw_headers: List of header dictionaries, each containing\n ``name`` and ``value`` keys.\n\nReturns:\n Dictionary mapping lowercase header names to stripped values.\n\nExample:\n Input:\n [\n {\"name\": \"From\", \"value\": \"John Doe <john@example.com>\"},\n {\"name\": \"Subject\", \"value\": \"Re: Interview Update\"},\n ]\n\n Output:\n {\n \"from\": \"John Doe <john@example.com>\",\n \"subject\": \"Re: Interview Update\",\n }"
},
"extract_sender": {
"name": "extract_sender",
"kind": "function",
"path": "mail_intake.parsers.headers.extract_sender",
"signature": "<bound method Function.signature of Function('extract_sender', 56, 87)>",
"docstring": "Extract sender email and optional display name from headers.\n\nThis function parses the ``From`` header and attempts to extract:\n- Sender email address\n- Optional human-readable display name\n\nArgs:\n headers: Normalized header dictionary as returned by\n :func:`parse_headers`.\n\nReturns:\n A tuple ``(email, name)`` where:\n - ``email`` is the sender email address\n - ``name`` is the display name, or ``None`` if unavailable\n\nExamples:\n ``\"John Doe <john@example.com>\"`` → ``(\"john@example.com\", \"John Doe\")``\n ``\"john@example.com\"`` → ``(\"john@example.com\", None)``"
}
}
}
}