Skip to main content
Glama

browser_fill

Fill form inputs in the browser, including React/Vue/Svelte controlled fields that reject JavaScript value assignment, using a CSS selector or semantic target.

Instructions

Fill a form input with a value via CDP — works on React/Vue/Svelte controlled inputs that reject browser_eval value assignment. Two ways to target: (1) selector — a CSS selector (use browser_overview / browser_locate to find one); or (2) by-axis (semantic) — by:'text'|'regex'|'role'|'ariaLabel' + pattern (e.g. by:'ariaLabel', pattern:'Email address', or by:'role', pattern:'textbox'), so you do not have to build a CSS selector. by-axis resolves to a SINGLE fillable element and STOPS with code:'BrowserAmbiguousTarget' (candidates[] + next[] hints) when 2+ match, or code:'BrowserNoActionableTarget' when the match is not a fillable input/textarea/contenteditable — it never guesses. Optionally add role to filter and scope to narrow. Provide EITHER selector OR by+pattern (not both). Use this over browser_eval when setting a controlled input's value via JS does not update framework state. Caveats: Requires browser_open (CDP active). actual in the response shows the element's value after fill; verify it matches the intended value (for a field the page masks, such as a password, neither the value you passed nor the one read back is echoed — valueWithheld:'masked' — and the match is still checked, in the page). Typed errors: code:'BrowserFillNotDelivered' on post-fill value mismatch — note the false-positive case where a React controlled input's onChange transforms the value (delivery actually succeeded; hints.verifyDelivery.subReason:'controlled_input_transform' for that case; the actual value is authoritative).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
byNoSemantic axis to target by INSTEAD of a CSS selector: 'text' (visible text), 'regex', 'role' (ARIA/implicit role), 'ariaLabel'. Pair with `pattern`. The server resolves to a SINGLE actionable element — climbing to a clickable ancestor up to 3 levels — and STOPS with a candidate list (code:'BrowserAmbiguousTarget') if the match is ambiguous; it never guesses.
portNoChrome/Edge CDP remote debugging port (default 9222; configurable via desktop-touch-config.json)
roleNoOptional ARIA/implicit-role filter AND-combined with `by` (e.g. by:'text', pattern:'Save', role:'button').
scopeNoOptional CSS selector to limit the `by`-axis search scope (disambiguation).
tabIdNoTab ID from browser_open. Omit to use the first page tab.
valueYesText to fill into the input element
includeNoOptional response-shape opt-in. `['envelope']` returns the self-documenting envelope (`_version` / `data` / `as_of` / `confidence`). `['raw']` forces raw shape (overrides DESKTOP_TOUCH_ENVELOPE=1 server default). Default behaviour is raw shape (compat with existing clients).
patternNoValue matched against the chosen `by` axis (required when `by` is set).
selectorNoCSS selector for the input element. Provide EITHER selector OR by+pattern.
caseSensitiveNoCase-sensitive matching for by:'text'/'regex' (default false).
includeContextNoWhen true (default), append `activeTab` + `readyState` lines to the response. Set false to skip — saves ~150 tokens per call when chaining several browser_* calls in the same tab.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed9 schema fields changedv2.3.1
    • addedInput schema / $schema
      Added value: +"http://json-schema.org/draft-07/schema#"
    • removedInput schema / additionalProperties
      Removed value: -false
    • changedInput schema / properties / by / description
      Previous value: -"Semantic axis to target by INSTEAD of a CSS selector: 'text' (visible text), 'regex', 'role' (ARIA/implicit role), 'ariaLabel'. Pair with pattern. Resolves to a SINGLE actionable element and STOPS with candidates when ambiguous."New value: +"Semantic axis to target by INSTEAD of a CSS selector: 'text' (visible text), 'regex', 'role' (ARIA/implicit role), 'ariaLabel'. Pair with `pattern`. The server resolves to a SINGLE actionable element — climbing to a clickable ancestor up to 3 levels — and STOPS with a candidate list (code:'BrowserAmbiguousTarget') if the match is ambiguous; it never guesses."
    • changedInput schema / properties / includeContext / description
      Previous value: -"When true, append activeTab and readyState context to the response."New value: +"When true (default), append `activeTab` + `readyState` lines to the response. Set false to skip — saves ~150 tokens per call when chaining several browser_* calls in the same tab."
    • changedInput schema / properties / pattern / description
      Previous value: -"Value matched against the chosen by axis (required when by is set)."New value: +"Value matched against the chosen `by` axis (required when `by` is set)."
    • addedInput schema / properties / pattern / minLength
      Added value: +1
    • changedInput schema / properties / port / description
      Previous value: -"Chrome/Edge CDP remote debugging port."New value: +"Chrome/Edge CDP remote debugging port (default 9222; configurable via desktop-touch-config.json)"
    • changedInput schema / properties / role / description
      Previous value: -"Optional ARIA/implicit-role filter AND-combined with by (e.g. by:'text', pattern:'Save', role:'button')."New value: +"Optional ARIA/implicit-role filter AND-combined with `by` (e.g. by:'text', pattern:'Save', role:'button')."
    • changedInput schema / properties / scope / description
      Previous value: -"Optional CSS selector to limit the by-axis search scope (disambiguation)."New value: +"Optional CSS selector to limit the `by`-axis search scope (disambiguation)."
  2. Addedv1.12.0
  3. Removedv1.10.4
  4. Addedv1.9.2
  5. Removedv1.8.0
  6. Addedv1.6.0
  7. Removedv1.5.1
  8. Addedv1.5.0
  9. Removedv1.4.3
  10. Addedv1.4.2
  11. Removedv1.4.0
  12. Changed1 schema field changedv1.2.1
    • addedInput schema / properties / include
      Added value: +{
      +  "description": "Optional response-shape opt-in. `['envelope']` returns the self-documenting envelope (`_version` / `data` / `as_of` / `confidence`). `['raw']` forces raw shape (overrides DESKTOP_TOUCH_ENVELOPE=1 server default). Default behaviour is raw shape (compat with existing clients).",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
  13. Addedv1.0.3

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden and does so: it discloses ambiguity handling (stops with BrowserAmbiguousTarget plus candidates[]/next[] hints), non-fillable targets (BrowserNoActionableTarget), never guessing, the BrowserFillNotDelivered error, the controlled_input_transform false positive, masked-field behavior (valueWithheld:'masked'), and the CDP/browser_open requirement.

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 purpose is front-loaded in the first clause and nearly every sentence carries non-redundant operational detail (errors, caveats, verification). It is a dense wall of nested parentheticals, though, and would scan better as bullets — the length is earned but the structure is heavy.

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 an 11-parameter, no-annotation, no-output-schema mutation tool, the description supplies what the structured fields lack: error taxonomy, verification semantics, masking caveat, and prerequisite. Nothing an agent needs to invoke 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%, so the baseline is 3; the description adds cross-parameter meaning by restating the selector-vs-by+pattern mutual exclusion and explaining what the by-axis resolution does to a match. It stops short of adding syntax or format detail beyond the schema's own enum and pattern documentation.

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+resource ('Fill a form input with a value via CDP') and immediately scopes the capability to React/Vue/Svelte controlled inputs that reject JS value assignment. An agent can distinguish it from browser_eval, browser_click, and browser_form without opening any schema.

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 names the alternative and the selecting condition: 'Use this over browser_eval when setting a controlled input's value via JS does not update framework state.' It also routes to browser_overview/browser_locate for selector discovery, states the EITHER selector OR by+pattern exclusivity, and notes the browser_open prerequisite.

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