Skip to main content
Glama

Save Email Attachment to Disk

save_attachment

Save a mail attachment to a local file and return its path. Use it for scanned PDFs, images, or documents that text extraction cannot read, or to pass a file to another tool.

Instructions

Save a mail attachment to a local file and return its path. Use for anything read_document cannot extract text from — scanned PDFs, photographed documents, images — and for handing a file to another tool. Read the saved file directly: PDFs and images are viewable without text extraction. Omit attachment_id when the message has exactly one attachment; otherwise get IDs from list_attachments.

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

Input Schema

NameRequiredDescriptionDefault
mailboxNoEmail address of another mailbox to act on (delegated or shared), e.g. 'someone@example.com'. Omit for your own mailbox; required when this server signs in as an application. Only addresses this server is configured to allow will be accepted.
out_dirNoDirectory to write into (default: the system temp directory). An existing file is never replaced; a numbered name is used instead.
message_idYesThe message ID, or a short ref returned by scan_messages
attachment_idNoWhich attachment to save. Optional when the message has exactly one.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.7/5.0
Behavior4/5

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

Annotations only say the operation is not read-only and not destructive; the description adds the concrete result (a file path) and post-call guidance to open the saved file directly rather than attempt text extraction. It does not repeat the non-overwrite behavior, but that is already documented on out_dir in the schema, so the remaining gap is small.

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 the core action and result, then selection criteria, then post-call advice, then parameter routing. No sentence restates another or wastes words.

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?

With no output schema, the description supplies the return value (path) and what to do with it. Combined with full schema coverage on the four parameters, an agent has everything needed to call this correctly and use the result.

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 coverage is 100%, so baseline is 3, but the description adds real semantics for attachment_id — omit it when the message has exactly one attachment, otherwise retrieve IDs from list_attachments — which is decision logic the schema does not express.

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 first sentence states a specific verb and resource — save a mail attachment to a local file — and adds the observable outcome (returns its path). It is clearly distinguishable from list_attachments (which enumerates IDs) and read_document (which extracts text).

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?

It names the conditions that select this tool: content read_document cannot extract text from (scanned PDFs, photos, images) and handing a file to another tool. It also routes the agent to list_attachments when attachment_id is needed, and states when attachment_id can be omitted.

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