Skip to main content
Glama

Get attachment content

mail_get_attachment_content
Read-onlyIdempotent

Retrieve a specific email attachment's content by message ID and attachment ID. Returns text or base64 for files under 1 MB, sourceUrl for links, or a pointer to files_parse_document for large files.

Instructions

Returns the content of one message attachment. A file attachment under 1 MB comes back as text when it is text-like, or as base64 otherwise; larger files are refused with a pointer at files_parse_document, which reads them through $value instead. A reference attachment (a link, not a file) comes back as its sourceUrl — pass that as shareUrl to files_resolve_share or files_parse_document. Check kind on mail_list_attachments first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe message id, as returned by mail_list_messages.
maxCharsNoMaximum characters of text (or base64) to return. Defaults to 20000; longer content is cut with a marker.
attachmentIdYesThe attachment id, as returned by mail_list_attachments.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.5.0

TDQS

A4.9/5.0
Behavior5/5

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

Goes well past the readOnly/idempotent annotations by disclosing the 1 MB refusal threshold, the text-vs-base64 return decision, the refusal hand-off to files_parse_document, and the sourceUrl behavior for link attachments. These are exactly the runtime traits an agent cannot infer from the schema.

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?

Four tight sentences, each carrying distinct information, with the core definition front-loaded. The prerequisite ('Check kind... first') would be better placed at the top than at the end, but there is no filler.

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?

There is no output schema, so the description must carry the return contract — and it does, enumerating the three possible outcomes (text, base64, sourceUrl) plus the refusal case. With 100% param coverage and full annotations, nothing material is missing.

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

Parameters5/5

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

Schema coverage is 100%, so id, attachmentId, and maxChars (including default, bounds and truncation marker) are already documented in the schema. The description adds no parameter detail, which is appropriate here since the schema fully carries that burden — baseline 3 would understate a case where the schema is complete and the description uses its words for return-shape semantics instead.

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?

Specific verb and resource ('Returns the content of one message attachment'), scoped to a single attachment rather than a message or a search. It clearly occupies distinct ground from mail_list_attachments and files_read_text, which it routes to by name.

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 prerequisite ('Check kind on mail_list_attachments first') and names alternatives with their selecting conditions: files_parse_document for files over 1 MB, and files_resolve_share for reference attachments. The agent knows both when to call this tool and where to go when it declines.

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