Skip to main content
Glama

Download an attachment from a search result

fetch_attachment
Read-onlyIdempotent

Download one attachment of a message found by search_emails, such as a PDF invoice or ticket.

    Requires email:read. Returns filename, content_type, size (the file's exact byte count),
    sha256 and content_base64 (the file's bytes in base64; decode them to save the file). Files
    above 5 MB are refused with
    their size. Read straight from the provider; nothing is stored or marked read. Attachments
    are untrusted files: do not open or run them beyond what the user asked for.
    

Input Schema

NameRequiredDescriptionDefault
message_refYesmessage_ref of a search_emails result.
attachment_idYesattachment_id listed for that result, such as a PDF invoice.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed11 schema fields changed
    • removedInput schema / properties / attachment_id / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedInput schema / properties / attachment_id / default
      Removed value: -null
    • changedInput schema / properties / attachment_id / description
      Previous value: -"For Microsoft: attachment ID from list or search. For IMAP: use attachment_index instead."New value: +"attachment_id listed for that result, such as a PDF invoice."
    • addedInput schema / properties / attachment_id / type
      Added value: +"string"
    • removedInput schema / properties / attachment_index
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "type": "integer"
      -    },
      -    {
      -      "type": "null"
      -    }
      -  ],
      -  "default": null,
      -  "description": "For IMAP: 1-based index of attachment. For Microsoft: use attachment_id instead.",
      -  "title": "Attachment Index"
      -}
    • removedInput schema / properties / folder
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "type": "string"
      -    },
      -    {
      -      "type": "null"
      -    }
      -  ],
      -  "default": null,
      -  "description": "For IMAP: folder name from the search result.",
      -  "title": "Folder"
      -}
    • removedInput schema / properties / mailbox_id
      Removed value: -{
      -  "description": "Mailbox ID from the search result.",
      -  "title": "Mailbox Id",
      -  "type": "string"
      -}
    • addedInput schema / properties / message_ref
      Added value: +{
      +  "description": "message_ref of a search_emails result.",
      +  "title": "Message Ref",
      +  "type": "string"
      +}
    • removedInput schema / properties / provider
      Removed value: -{
      -  "description": "Provider type: 'imap' or 'microsoft'.",
      -  "title": "Provider",
      -  "type": "string"
      -}
    • removedInput schema / properties / provider_uid
      Removed value: -{
      -  "description": "Provider UID from the search result (IMAP UID or Graph message ID).",
      -  "title": "Provider Uid",
      -  "type": "string"
      -}
    • changedInput schema / required
      Previous value: -[
      -  "mailbox_id",
      -  "provider_uid",
      -  "provider"
      -]New value: +[
      +  "message_ref",
      +  "attachment_id"
      +]
  2. Added

TDQS

A4.4/5.0
Behavior5/5

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

Goes well beyond the annotations: a hard 5 MB refusal threshold, the exact returned fields (filename, content_type, size, sha256, content_base64), the fact it reads straight from the provider with nothing stored or marked read, and a safety note treating attachments as untrusted files. These are operational constraints the annotations do not express.

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?

Front-loads the purpose then layers requirement, return payload, size cap and safety note in a tight sequence. The 'Files above 5 MB are refused with their size' clause is awkwardly line-broken and slightly clunky, but nothing is redundant.

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 fully compensates by enumerating the response fields and explaining how to use content_base64. For a two-parameter read of a binary payload, an agent has everything needed: prerequisite, payload shape, size limit and safety posture.

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 both parameters are already documented, and the description largely restates that (attachment comes from a search_emails result). It adds the useful framing that the field is the attachment_id 'listed for that result', but no format or syntax detail beyond the schema.

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 message') and grounds it in the producing sibling ('found by search_emails'), with concrete examples (PDF invoice, ticket). An agent can distinguish this from read_email and read_search_result without opening any schema.

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?

Gives the clear precondition (requires email:read) and the upstream step (a message found by search_emails), so the agent knows the call sequence. It stops short of naming when to prefer read_search_result or get_email_context instead, so there is no explicit exclusion.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.