Skip to main content
Glama
andresolbach

nodriver-mcp-server

Upload file

upload_file

Upload a local file to a page's file input via CDP, avoiding OS file picker dialogs. Resolves the real input from a uid and reports upload success.

Instructions

Attach a local file to a file input on the page.

Sets the input's files directly over CDP, so no OS file-picker dialog ever opens — clicking an upload button normally would open one, and that blocks every further tool call until a human dismisses it.

Chrome renders a file input with an internal shadow button, and that is what the accessibility tree exposes, so the uid you can see is usually not the input itself. This resolves to the real input: the element, one inside it, the input a label controls, or one just above in the tree.

The result is read back. If the page's own uploader consumed the file straight away, the response says so, which is a successful upload rather than an empty input.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uidYesuid of the file input, or of the button, label or drop zone in front of it — the real <input type="file"> is resolved from there. Comes from the most recent take_snapshot.
browserNoWhich browser to act on. Each name is an independent Chrome, created on first use. Omit for the shared default; parallel agents each need their own name.default
file_pathYesAbsolute path to a local file on the machine running this server.
include_snapshotNoAppend a fresh page snapshot to the response. Worth it when this action changes the page and take_snapshot would be your next call anyway — it saves a round trip, at the cost of a much larger response.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv2.5.0
    • addedInput schema / properties / browser
      Added value: +{
      +  "default": "default",
      +  "description": "Which browser to act on. Each name is an independent Chrome, created on first use. Omit for the shared default; parallel agents each need their own name.",
      +  "type": "string"
      +}
    • changedInput schema / properties / uid / description
      Previous value: -"uid of the <input type=\"file\"> element, from the most recent take_snapshot. It must be the file input itself, not the styled button or drop zone layered over it."New value: +"uid of the file input, or of the button, label or drop zone in front of it — the real <input type=\"file\"> is resolved from there. Comes from the most recent take_snapshot."
  2. First observedv1.7.2

TDQS

A4.9/5.0
Behavior5/5

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

Annotations only say readOnlyHint=false, idempotentHint=false, openWorldHint=true, destructiveHint=false. The description adds meaningful behavioral context: file selection happens over CDP (no dialog), the shadow-DOM resolution strategy, the blocking hazard of a dialog, and how to interpret the response when the page consumes the file immediately.

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?

Purpose is front-loaded in the first sentence and the remaining paragraphs each explain a distinct behavior or hazard without redundancy. The length is justified by the non-obvious CDP/shadow-DOM behavior and response interpretation.

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 mutating file-upload tool with an output schema and a full input schema, the description covers prerequisites (local file path), the failure mode to avoid (dialog blocking), the resolution of uid ambiguities, and the success signal in the response. Nothing an agent needs to call it correctly 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?

Schema coverage is already 100% with detailed descriptions for uid, browser, file_path, and include_snapshot, so the baseline is 3. The description adds extra uid semantics (usually the accessibility-tree element, not the raw input, and how it is resolved) that sharpens parameter use 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 (attach) and resource (a local file to a file input on the page), and immediately contrasts itself with clicking an upload button. The mechanism and target element are unambiguous, so an agent can distinguish upload_file from siblings like click or fill.

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?

Explicitly warns that clicking an upload button would open an OS file-picker dialog that blocks further calls, making this the tool to use in that scenario. It also clarifies that the uid may point at the shadow button/label rather than the input and that the tool resolves it, so agents know what uid to pass without guessing.

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