Skip to main content
Glama

Gmail Download Attachment

gmail_download_attachment

Downloads a Gmail attachment and saves it to a specified path on the local server, creating parent folders and overwriting an existing file. Get the download_id from the email read first.

Instructions

Download one attachment of a Gmail message and save it to a file on the server's own filesystem. It works only when the server runs locally (stdio) and is refused over remote MCP; get the attachment's download_id from gmail_read_emails first. Returns status 'ok', saved_to (the path written) and bytes_written. Creates missing parent folders and overwrites an existing file at output_path.

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": {
      "attachment_id": "<attachment_id>",
      "message_id": "<message_id>",
      "output_path": "<output_path>"
    },
    "name": "gmail_download_attachment"
  }
}

Input Schema

NameRequiredDescriptionDefault
message_idYesGmail message ID, from gmail_search_emails, gmail_get_mail_digest, gmail_check_mail_updates or gmail_get_thread results.
output_pathYesFile path on the server's machine to write, e.g. '/tmp/invoice.pdf'; missing folders are created and an existing file is overwritten.
attachment_idYesThe attachment's download_id from gmail_read_emails for the same message_id.

Output Schema

NameRequiredDescriptionDefault
statusNoMachine-readable operation status.
saved_toNo
bytes_writtenNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv2.2.0

TDQS

A4.5/5.0
Behavior4/5

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

Beyond the annotations it discloses the critical transport constraint (stdio-only, refused remotely), the ordering dependency on gmail_read_emails, and the filesystem side effects of creating parent folders and overwriting an existing file. Minor tension: annotations set destructiveHint=false while the description says an existing file at output_path gets overwritten, so an agent reading only annotations could underestimate the data-loss risk — the prose corrects this rather than contradicting it.

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?

Four short sentences, front-loaded with what the tool does, then the hard constraint, then the prerequisite, then the return shape and side effects. No filler and nothing buried at the end that an agent needs before calling.

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

Completeness5/5

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

For a three-parameter write tool this covers everything an agent must know to invoke it correctly: local-only availability, prerequisite lookup, path semantics, and the success response fields (status, saved_to, bytes_written) even though an output schema also exists. Nothing material is left to inference.

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%, so all three parameters are already documented, including the download_id provenance and the overwrite/folder-creation behavior of output_path. The description largely restates those schema facts; its only surplus is repeating where download_id comes from, so the baseline 3 applies.

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 and resource ('Download one attachment of a Gmail message and save it to a file'), plus the scope limit ('one attachment') and the target ('the server's own filesystem'). An agent can immediately separate this from gmail_read_emails, which only surfaces download_id, and from drive_download_file, which targets a different store.

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?

Gives an explicit precondition chain: get the attachment's download_id from gmail_read_emails first, and the tool only works when the server runs locally via stdio, being refused over remote MCP. That is both a when-to-use and a when-not-to-use statement, with the prerequisite tool named.

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

Deploy Server

Other Tools