Skip to main content
Glama

ofw_download_attachment

Get a message attachment by fileId as a viewable image, extracted text from spreadsheets, PDFs, docx, pptx, or text files, or raw bytes when no extraction applies.

Instructions

Download an OFW message attachment by fileId and return content you can actually read. Inline delivery walks a ladder and returns the first rung that works: (1) host-renderable images (PNG/JPEG/GIF/WEBP) come back as ImageContent; (2) .xlsx/.csv/.tsv, .pdf, .docx, .pptx and text files come back as EXTRACTED CONTENT — per-sheet CSV, per-page/slide text, document text — in the response JSON under extracted; (3) anything else comes back as an EmbeddedResource blob of the raw bytes. The meta block names the rung as deliveredVia and, when it falls through to bytes, lists what was tried in deliveryAttempts. Reported mime types are always normalized to a bare media type (no charset/name parameters). In disk mode the bytes are saved to ~/Downloads/ofw-mcp/ and the response carries the absolute path; pass extract:true to ALSO get the extracted content in that response. The default for inline can be flipped server-side via the OFW_INLINE_ATTACHMENTS env var. On a hosted deployment with no filesystem, disk mode is unavailable, so inline is forced (forcedInline:true) rather than failing — a saveTo path never costs you the content. fileId comes from attachments[].fileId on ofw_get_message. Override disk destination with OFW_ATTACHMENTS_DIR or saveTo; saveTo must stay inside the attachments directory, and an existing file is never overwritten unless force:true. Re-downloading to the same path is a no-op (disk mode only).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
forceNoRe-download even if already on disk, replacing any existing file at the destination. Default false. Ignored when inline:true (inline always fetches fresh bytes, or reuses an on-disk copy if present).
partsNoWhich sheets / slides / pages to extract, e.g. "1-3,5" (1-based positions) or a sheet name like "2026". A bare number matches either a position or a name. Omit for everything. Unselected parts are listed in `extracted.omitted`.
fileIdYesAttachment file id (from ofw_get_message → attachments[].fileId)
inlineNoIf true, return content inline as MCP content blocks and skip the disk write. If false, write to disk and return the path — except on a hosted deployment with no filesystem, where inline is forced (forcedInline:true) so the content is still returned. If omitted, falls back to the OFW_INLINE_ATTACHMENTS env var (default: false = disk).
saveToNoPath or directory to write to, INSIDE the attachments directory (OFW_ATTACHMENTS_DIR, default ~/Downloads/ofw-mcp); a relative path is resolved against it and anything outside it is refused. If a directory (trailing /), the OFW filename is used. Default: <attachments dir>/<fileId>-<filename>. An existing file is not overwritten unless force:true. Ignored when inline is in effect.
extractNoWhether to extract readable content from the file. Default: on for inline delivery of any non-image type, off in disk mode. Set false to get the raw bytes inline instead of extracted text (e.g. to hash or re-upload the file); set true in disk mode to get both the saved path and the extracted content.
maxCharsNoCeiling on extracted characters (default 50000). Over it, content is clipped on a row/line boundary, `truncated` is set, and anything dropped whole is listed in `extracted.omitted`.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.19.4

TDQS

A4.6/5.0
Behavior5/5

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

The annotations only say readOnlyHint=false and destructiveHint=false, which are minimal. The description carries the full behavioral burden and does so excellently: it discloses the delivery ladder (images vs extracted content vs raw bytes), the fallback to forced inline on hosted deployments, the disk-write behavior with path and overwrite rules, mime-type normalization, and the no-op re-download behavior. Nothing contradicts the annotations, and the description adds far more context than the annotations provide.

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?

The description is long but densely packed with essential details. It front-loads the core purpose and then systematically explains the delivery ladder, modes, defaults, and constraints. The numbered list and logical flow make it scannable. Every sentence contributes to understanding, with no filler. It is not overly verbose given the tool's complexity, so a 4 is appropriate.

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 tool with seven parameters, one required, and no output schema, the description is remarkably complete. It covers all delivery modes, return formats (ImageContent, extracted content, EmbeddedResource blob, saved path), the meta block fields (deliveredVia, deliveryAttempts), environment variable overrides, filesystem constraints, overwrite rules, and extraction limits. It even tells the agent how to obtain fileId from a sibling tool. No critical operational detail is missing.

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?

The input schema has 100% parameter coverage with descriptive text for all seven parameters, so the baseline is 3. The description adds meaningful value beyond the schema: it explains the interaction between extract and inline/disk mode, the default values (e.g., extract default varies by mode), the saveTo path constraints and relative resolution, and the effect of maxChars on clipping. This elevates it to a 4.

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 description opens with a clear verb-resource pair ('Download an OFW message attachment by fileId') and immediately states the output's value ('return content you can actually read'). It then enumerates three distinct delivery modes, which clearly differentiates it from siblings like ofw_upload_attachment (which does the opposite) and ofw_get_message (which provides the fileId). The purpose is unambiguous and distinct.

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?

The description gives strong contextual guidance: it tells the agent that fileId comes from ofw_get_message's attachments[].fileId, explains when inline vs disk mode applies, and documents the default behavior and env-var override. It stops short of explicitly stating when not to use the tool or naming alternative tools beyond the fileId source, so it earns a 4 rather than a 5.

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