Skip to main content
Glama

imap_get_attachment

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

Instructions

Download one attachment to disk

Input Schema

TableJSON 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

TableJSON 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

A3.9/5.0
Behavior4/5

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

No annotations are provided, so the text carries the burden. The schema-filled description explains the non-trivial behavior: it writes decoded bytes to disk and returns a path, keeps large binaries out of the response, and only inlines base64 when explicitly requested via include_base64 with a size ceiling (max_inline_bytes), "off by default to protect the context window." Small gaps remain (overwrite policy, error when the attachment is not found), but the core side effects are disclosed.

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 seven-word sentence that front-loads the purpose with zero filler; all the detail efficiently lives in the schema. If anything it is almost too terse on its own (it doesn't mention file-side returns), but it does its part alongside the schema and is appropriately sized.

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

Completeness4/5

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

With an output schema present and 100% parameter documentation, an agent can invoke this tool: message_id is required, part selection by part_id or filename is described, defaults and environment-behavior are given, and the inline-base64 safety contract is stated. The only real ambiguity is that neither part_id nor filename is explicitly required — an agent could call it with only message_id; a brief 'supply one of part_id/filename' line would make the contract airtight.

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 description coverage is 100%, so the parameters are already well-documented: part_id takes precedence over filename, filename is case-insensitive, output_dir falls back to environment variables or system temp, max_inline_bytes defaults to 256 KiB. The description itself adds no extra meaning beyond these, which is consistent with the baseline-3 rule for high coverage.

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

Purpose5/5

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

The description is a compact, specific claim: 'Download one attachment to disk' — a verb, a resource, and a destination. It distinguishes this tool from siblings like imap_get_message and imap_get_message_raw (which fetch the message, not an attachment) and from ews_get_message, so an agent can pick the right tool from the name/description alone.

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

Usage Guidelines3/5

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

There is no explicit when-to-use or when-not-to-use guidance and no mention of alternatives in the description. The schema hints at the workflow implied by 'as shown by imap_get_message' (list a message's attachments first), but that is an implicit pointer rather than a stated selection rule, so the agent must infer the usage context.

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