Skip to main content
Glama

Capture a file download

download

Capture a browser file save by arming before the trigger, then collect the resulting path and state.

Instructions

Capture a browser download: call action='arm' BEFORE triggering and require armed:true, trigger the download (click/navigate), then action='collect' for {state, path}. state 'in_progress' means the download started but has not finished: call collect again and do NOT trigger the download again. Arming again while your download is in progress, or after it finished but before collect, changes nothing and answers armed:false with a note that names the waiting file; collect is the next call. In browser_batch and in a recipe such an arm fails its step, so the trigger after it does not run. A finished result left uncollected for 330s is dropped by the next arm. Only one session can arm at a time; an abandoned arm expires after 330s, and a started download's capture expires 330s after the download began (collect calls do not extend it). Attribution is browser-wide, so keep the arm window short. Capture state survives service-worker restart within this browser session; if the worker restarts mid-wait, call collect again. Extension reload and browser restart clear capture state. The file lands in your browser's normal download folder.

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": {
      "action": "<action>",
      "tabId": "<tabId>"
    },
    "name": "download"
  }
}

Input Schema

NameRequiredDescriptionDefault
tabIdYesTarget tab ID (must be in the MCP group)
actionYesarm before triggering; collect after
timeoutMsNocollect: max wait in ms (default 30000, max 270000; Chrome terminates a worker when one request exceeds 5 minutes)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.24.1

TDQS

A4.1/5.0
Behavior3/5

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

With no annotations supplied, the description carries the full burden and does substantial work: it discloses the 330s expiry for abandoned arms, downloads, and uncollected results, single-session arming, browser-wide attribution, and that collect calls do not extend the capture window. It also states that capture state survives service-worker restart but is cleared by extension reload or browser restart, and where the file lands. The remaining gap is the return contract: only 'armed:true/false', 'state in_progress', and '{state, path}' are named, with no enumeration of terminal or failure states.

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 protocol and the trigger-first rule are front-loaded, and nearly every sentence adds operational information. The middle sentences are dense run-ons (the arming-again clause packs four conditions into one sentence), which costs some readability but not correctness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a stateful two-call tool with no output schema, the definition covers timing, concurrency, persistence, and failure modes well. The shortfall is that without an output schema the description should enumerate the possible state values and the shape of the armed:false note, rather than only naming 'in_progress'.

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 description coverage is 100%, so the baseline is 3. The description does add real meaning to the action enum by explaining the arm-then-collect lifecycle and the consequences of misuse, but timeoutMs is never mentioned in the description and is left entirely to 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?

The opening clause names a specific verb and resource ('Capture a browser download') and immediately frames it as a two-phase arm/collect protocol, which is the defining behavior an agent must know. It is clearly distinguishable from siblings like file_upload or file_drop, which move data rather than observe a browser-initiated download.

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 gives explicit ordering instructions ('call action=arm BEFORE triggering'), explicit negative guidance ('do NOT trigger the download again' on in_progress), and explicit recovery guidance ('call collect again'). It also warns that arming inside browser_batch or a recipe fails the step, which is precisely the when-not context an agent needs.

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