Skip to main content
Glama

upload_file

Destructive

Attach a local file to a browser page's file input via Chrome DevTools Protocol, bypassing the sandbox's invisible native picker that hangs the renderer.

Instructions

Attach a local file to a page's via Chrome DevTools Protocol — use this for ALL browser uploads (logos, images, docs).

The sandbox's native GTK file picker is invisible to us AND hangs the renderer, so never click an upload button expecting a dialog — call this instead. Works on Chromium-family browsers started by launch_app / start-display.sh (they open a per-instance --remote-debugging-port, 9222+N). selector targets the file input on the MAIN page (default = first file input). With several tabs open the most recently active page target is used unless page_url_contains picks the tab by a URL fragment. If the site only inserts the after you click its 'upload' control, click that first (it won't open a dialog we can see, but it wires up the input), then call this. Relative paths resolve against files//. Returns {"ok", "action", "instance", "detail", "page"}; fails (isError) with the reason if the file is missing, no CDP target answers, or the selector matches nothing. NATIVE (non-browser) apps: use open_file() or drive the app's own Open dialog — it IS visible here. observe/settle_ms: see click().

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": {
      "filepath": "<filepath>"
    },
    "name": "upload_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
observeNonone
filepathYes
instanceNo
selectorNoinput[type=file]
settle_msNo
observe_regionNo
page_url_containsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.6.1
    • addedInput schema / properties / observe_region
      Added value: +{
      +  "default": "",
      +  "title": "Observe Region",
      +  "type": "string"
      +}
  2. Changed1 schema field changedv0.3.0
    • addedInput schema / properties / page_url_contains
      Added value: +{
      +  "default": "",
      +  "title": "Page Url Contains",
      +  "type": "string"
      +}
  3. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

Annotations only say the call is not read-only, is destructive and open-world; the description adds substantial context beyond that: which browser stack it works against, per-instance debugging ports, how the target tab is chosen, the return payload shape {ok, action, instance, detail, page}, and the exact failure conditions (missing file, no CDP target, selector matches nothing). That is meaningful behavioral disclosure an agent cannot get from the structured fields.

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?

Dense but front-loaded: the core action and the prohibition lead, then environment, selector/tab semantics, return/failure contract, and finally native-app redirection. A few clauses about the GTK picker restate the same point, but almost every sentence carries actionable information.

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 seven-parameter tool with no output schema, the description still supplies the return shape and failure semantics, plus the environment assumptions needed to succeed. The remaining gaps are the observe/settle_ms/observe_region knobs, which are delegated by reference to another tool rather than described.

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 0%, so the description carries the burden. It explains selector (targets the file input on the MAIN page, default first file input), page_url_contains (picks the tab by URL fragment), and filepath path resolution against files/<N>/, but leaves instance, observe_region, and observe/settle_ms largely unexplained ('see click()'). Partial compensation for a seven-parameter 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?

Opens with a specific verb, resource and mechanism: attach a local file to a page's <input type=file> via CDP. It explicitly scopes itself as the tool for ALL browser uploads and names the native-app counterpart (open_file), so the agent can separate it from sibling tools without reading schemas.

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 when-to-use ('use this for ALL browser uploads'), when-not ('never click an upload button expecting a dialog', 'never click' a native picker), the prerequisite environment (Chromium started by launch_app / start-display.sh with --remote-debugging-port 9222+N), and the ordering rule when the site injects the input only after clicking upload. Alternatives for native apps are named.

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