Skip to main content
Glama

Download attachment

download_attachment
Read-only

Retrieve metadata and a resource link for one email attachment, with optional inline content or PDF page-range text extraction.

Instructions

Get metadata and a resource link for one attachment. With inline, the result also includes the content. For a PDF, inline adds extracted text, and pages returns the text of a page range such as 201-400. The size limit is 10 MB. To keep an attachment as a file, or to get one over the limit, save it with save_attachment.

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": {
      "messageId": "<messageId>",
      "attachmentId": "<attachmentId>"
    },
    "name": "download_attachment"
  }
}

Input Schema

NameRequiredDescriptionDefault
pagesNoPDF page or page range to read as text, such as 201-400
inlineNo
accountIdNoAccount to operate on. Optional when exactly one account is connected.
messageIdYes
attachmentIdYesOpaque attachment ID returned by message metadata

Output Schema

NameRequiredDescriptionDefault
dataYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.19.0
    • changedInput schema / properties / accountId / anyOf
      Previous value: -[
      -  {
      -    "minLength": 1,
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "maxLength": 512,
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • addedInput schema / properties / attachmentId / maxLength
      Added value: +512
    • addedInput schema / properties / messageId / maxLength
      Added value: +512
  2. Changed10 schema fields changedv0.15.0
    • addedInput schema / properties / accountId / anyOf
      Added value: +[
      +  {
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • addedInput schema / properties / accountId / description
      Added value: +"Account to operate on. Optional when exactly one account is connected."
    • removedInput schema / properties / accountId / minLength
      Removed value: -1
    • removedInput schema / properties / accountId / type
      Removed value: -"string"
    • changedInput schema / properties / inline / type
      Previous value: -"boolean"New value: +[
      +  "boolean",
      +  "null"
      +]
    • removedInput schema / properties / messageId / $ref
      Removed value: -"#/properties/accountId"
    • addedInput schema / properties / messageId / minLength
      Added value: +1
    • addedInput schema / properties / messageId / type
      Added value: +"string"
    • addedInput schema / properties / pages
      Added value: +{
      +  "anyOf": [
      +    {
      +      "description": "PDF page or page range to read as text, such as 201-400",
      +      "pattern": "^[1-9]\\d{0,5}(-[1-9]\\d{0,5})?$",
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "description": "PDF page or page range to read as text, such as 201-400"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "accountId",
      -  "messageId",
      -  "attachmentId"
      -]New value: +[
      +  "messageId",
      +  "attachmentId"
      +]
  3. Changed1 schema field changedv0.11.1
    • removedOutput schema / $schema
      Removed value: -"http://json-schema.org/draft-07/schema#"
  4. Changed7 schema fields changedv0.11.0
    • removedInput schema / properties / accountId / description
      Removed value: -"Account to operate on. Optional when exactly one account is connected."
    • addedInput schema / properties / inline
      Added value: +{
      +  "type": "boolean"
      +}
    • addedInput schema / properties / messageId / $ref
      Added value: +"#/properties/accountId"
    • removedInput schema / properties / messageId / minLength
      Removed value: -1
    • removedInput schema / properties / messageId / type
      Removed value: -"string"
    • changedInput schema / required
      Previous value: -[
      -  "messageId",
      -  "attachmentId"
      -]New value: +[
      +  "accountId",
      +  "messageId",
      +  "attachmentId"
      +]
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": false,
      +  "properties": {
      +    "data": {
      +      "additionalProperties": true,
      +      "properties": {
      +        "filename": {
      +          "type": "string"
      +        },
      +        "id": {
      +          "type": "string"
      +        },
      +        "mimeType": {
      +          "type": "string"
      +        },
      +        "sizeBytes": {
      +          "type": "number"
      +        }
      +      },
      +      "required": [
      +        "id",
      +        "filename",
      +        "mimeType",
      +        "sizeBytes"
      +      ],
      +      "type": "object"
      +    }
      +  },
      +  "required": [
      +    "data"
      +  ],
      +  "type": "object"
      +}
  5. Changed4 schema fields changedv0.9.0
    • removedInput schema / properties / attachmentId / $ref
      Removed value: -"#/properties/messageId"
    • addedInput schema / properties / attachmentId / description
      Added value: +"Opaque attachment ID returned by message metadata"
    • addedInput schema / properties / attachmentId / minLength
      Added value: +1
    • addedInput schema / properties / attachmentId / type
      Added value: +"string"
  6. 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 already declare readOnlyHint=true and destructiveHint=false, so safety is covered. The description adds real behavioral context the annotations cannot: a hard 10 MB size limit, that inline changes the result payload, and that PDF inline yields extracted text with pages selecting a range. It stops short of saying what happens on an over-limit call or how the resource link is shaped, keeping it below a 5.

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?

Five short sentences, front-loaded with the core purpose before modifiers, the limit, and the alternative. Each sentence carries distinct information — result shape, inline effect, PDF/page behavior, limit, and escape hatch — with no restatement of the title or name.

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 read-only fetch with five parameters and an existing output schema, the description covers everything an agent needs to choose and invoke it: purpose, modality switches, size constraint, and the correct fallback tool. Return-value detail is legitimately delegated to the output schema.

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 60%, and the biggest gap is inline, which has no schema description at all; the description compensates by explaining exactly what inline does to the result and how it interacts with PDFs. pages is reinforced with a concrete example range and stated return meaning, though messageId and the accountId fallback behavior get no additional clarification 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 with explicit scope: 'Get metadata and a resource link for one attachment.' It also delineates what the tool does not do (file persistence) and routes that to a named sibling, so an agent can distinguish it from save_attachment without opening either schema.

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 explicit when-to-use branches: use inline to get content, use pages for a PDF page range, and use save_attachment when the goal is a file or the attachment exceeds 10 MB. The alternative and the condition that selects it are both stated.

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