Skip to main content
Glama

imap_get_attachment

Idempotent

Download a single email attachment to disk by message ID and part ID or filename, returning the saved file path instead of loading large binaries into the response.

Instructions

Download one attachment to disk

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": "imap_get_attachment"
  }
}

Input Schema

NameRequiredDescriptionDefault
part_idNoMIME part id to fetch (e.g. `1.2`), as shown by `imap_get_message`. Takes precedence over `filename` when both are given.
filenameNoAttachment filename to fetch (case-insensitive). Used when `part_id` is omitted.
account_idNoAccount identifier (defaults to `"default"`)default
message_idYesStable message identifier
output_dirNoDirectory to save the attachment into. Overrides the server default (`MAIL_ATTACHMENT_DOWNLOAD_DIR`, else the system temp dir).
include_base64NoAlso return the raw bytes as base64 in the response, but only if the attachment is at most `max_inline_bytes`. Off by default to protect the context window.
max_inline_bytesNoSize ceiling (bytes) for inline base64. Ignored unless `include_base64` is `true`. Defaults to 262144 (256 KiB).

Output Schema

NameRequiredDescriptionDefault
dataYesTool-specific data payload
metaYesExecution metadata (timestamp, duration)
summaryYesHuman-readable summary of the operation outcome

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.4.12

TDQS

B3.4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare openWorldHint=true, idempotentHint=true, destructiveHint=false, and readOnlyHint=false. The description only restates that bytes go to disk and adds no overwrite semantics, permission notes, or mention of the large-binary/context-window protection that appears in the schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single front-loaded sentence with zero filler, though its terseness leaves no room for the guidance an agent would benefit from.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema and fully documented parameters carry most of the load, but for a tool that writes files the description should at least state overwrite behavior and the part_id-vs-filename selection path.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and the schema already documents part_id precedence over filename, output_dir overrides, and the include_base64/max_inline_bytes gate. The description contributes nothing beyond the parameter list, so the baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

"Download one attachment to disk" gives a specific verb (download) and resource (one attachment), which cleanly separates it from the sibling message-fetching tools. It never names an alternative explicitly, so it falls short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The schema text notes part_id is "as shown by imap_get_message", which implicitly links to the prerequisite step, but the description itself offers no when-to-use vs. when-not guidance or mention of the sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.