get_message
Fetch a single Gmail message by ID to retrieve headers, body content, and attachment metadata, with optional local-file output or metadata-only retrieval.
Instructions
Fetch a single message by ID, including headers, body, and attachment metadata.
Args: message_id: The Gmail message ID (from list_messages or get_thread). local_path: Optional local filesystem path (file or directory) to write the message JSON to instead of returning it inline. Bypasses the response-size cap, for messages with very large bodies. A path ending in '/' is a directory, created if missing. A file in place of a parent directory, or at a path ending in '/', raises ValueError; an existing file at a plain file path is replaced. include_body: When False, fetch only metadata (Gmail's format='metadata'): no body is downloaded, and body_plain, body_html, and attachments are left out of the result.
Returns: Message with id, thread_id, snippet, label_ids, headers (from/to/cc/bcc/ subject/date/message_id), body_plain, body_html, and attachments metadata (filename, mime_type, size, attachment_id). A large body that Gmail delivers separately is fetched and returned in body_plain/body_html like any other. A text part whose data can't be decoded leaves its body null and is listed in body_decode_errors; a separately delivered body that can't be fetched leaves its body null and is listed in body_fetch_errors (both: part_id, mime_type, error, plus attachment_id for a separately delivered part; present only when non-empty). Raises an error naming the size if the message is over the response-size cap and local_path is not set; a separately delivered body already over the cap raises before being downloaded. If local_path is set, returns {local_path, message_id, bytes_written} instead, plus body_fetch_errors / body_decode_errors (each entry with message_id) when present. With include_body=False, only id, thread_id, snippet, label_ids, internal_date, size_estimate, and headers. On API failure, {"error": "..."}.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"message_id": "<message_id>"
},
"name": "get_message"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| local_path | No | ||
| message_id | Yes | ||
| include_body | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||