Skip to main content
Glama
codefuturist

Email MCP Server

by codefuturist

Download attachment

download_attachment
Read-only

Download an email attachment by filename or part ID, returning base64-encoded content for files up to 5MB. Use part ID for duplicate filenames.

Instructions

Download an email attachment by filename or part id. First use get_email to see available attachments with their filenames and partIds (partId is unambiguous — use it for duplicate filenames and inline cid images). Returns base64-encoded content for files ≤5MB. saveToDownloadDir is unavailable — no attachment download directory is configured on this server.

Input Schema

NameRequiredDescriptionDefault
idYesEmail ID (UID) from list_emails or get_email
partIdNoMIME part id from get_email metadata (takes precedence over filename)
saveAsNoFilename to save as under the download directory (basename only, no path separators). Only used with saveToDownloadDir; defaults to the attachment’s own filename.
accountYesAccount name from list_accounts
mailboxNoMailbox containing the emailINBOX
filenameNoExact attachment filename (from get_email metadata)
saveToDownloadDirNoWrite the attachment to the server-configured download directory instead of returning it base64-encoded. Fails if no download directory is configured.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv0.6.0
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedInput schema / properties / partId
      Added value: +{
      +  "description": "MIME part id from get_email metadata (takes precedence over filename)",
      +  "type": "string"
      +}
    • addedInput schema / properties / saveAs
      Added value: +{
      +  "description": "Filename to save as under the download directory (basename only, no path separators). Only used with saveToDownloadDir; defaults to the attachment’s own filename.",
      +  "type": "string"
      +}
    • addedInput schema / properties / saveToDownloadDir
      Added value: +{
      +  "default": false,
      +  "description": "Write the attachment to the server-configured download directory instead of returning it base64-encoded. Fails if no download directory is configured.",
      +  "type": "boolean"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "account",
      -  "id",
      -  "filename"
      -]New value: +[
      +  "account",
      +  "id"
      +]
  2. First observedv0.2.3

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, so safety is covered. The description adds valuable behavioral context: base64-encoded return, a ≤5MB size limit, and the unavailability of saveToDownloadDir. It does not explain what happens for files larger than 5MB, so it is strong but not exhaustive.

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

Conciseness5/5

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

Three tight sentences, front-loaded with the primary action. Each sentence contributes unique operational information: the get_email prerequisite, the return format and size limit, and the disabled save option.

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?

For a 7-parameter read-only tool with no output schema, the description supplies the key context an agent needs: how to discover attachments, what the return value looks like, the size limit, and the disabled save directory. It omits the behavior for attachments larger than 5MB, leaving a minor gap.

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

Parameters4/5

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

Schema description coverage is 100%, so the baseline is 3. The description adds decision-relevant meaning beyond the schema by highlighting partId precedence for duplicate filenames and inline cid images, and by declaring saveToDownloadDir unavailable, which directly affects parameter usage.

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?

States a specific verb ('Download') and resource ('email attachment'), and clarifies the two selection mechanisms ('filename or part id'). It also points to get_email for discovering attachments, which implicitly separates its role from the retrieval tool.

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

Usage Guidelines5/5

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

Explicitly instructs the agent to first use get_email, and advises using partId for duplicate filenames and inline cid images. It also states that saveToDownloadDir is unavailable, giving clear when-not-to-use guidance.

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