Skip to main content
Glama

Fill field in browser

browser_fill
DestructiveIdempotent

Replaces the entire value of an input, textarea, or contenteditable field by snapshot index in an agent Chrome tab, sending trusted text events and verifying the result without focusing the tab.

Instructions

Replace the whole value of a text field in one of the agent's tabs: focuses the element by its browser_snapshot index, selects everything in it and puts the text in through Chrome's own text input, so the page sees the same trusted input events as typing. Works on input, textarea and contenteditable fields, including inside web components (open shadow roots), in a background tab without selecting it or raising its window. Pass an empty string to clear the field. The reply says whether the field now holds exactly the text, and what it holds when the page changed or limited it (not for password fields). Use browser_type to add at the caret instead, and browser_request_credentials for passwords and codes. Never use the desktop press_key or type_text for a Chrome tab: those go to whichever Chrome window is in front, which can be the user's.

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": {
      "tab_id": "<tab_id>",
      "index": "<index>",
      "text": "<text>"
    },
    "name": "browser_fill"
  }
}

Input Schema

NameRequiredDescriptionDefault
textYesThe field's new value, replacing everything in it. Empty clears the field.
indexYesElement index of the field from the latest browser_snapshot of this tab. An index naming a wrapper that holds exactly one field fills that field.
tab_idYestab_id of one of the agent's tabs, from browser_open_tab or browser_list_tabs
session_idNoStable task or thread ID. Pass the same value on every browser call for this task. Different IDs isolate tabs and cleanup within one MCP process. Omit for the default process session.
return_stateNoAppend a current snapshot and readiness status after acting. Without wait_for_selector, only a short pause and bounded navigation wait are used; SPA readiness is not guaranteed. Snapshot indices replace earlier ones. A timeout does not mean the action failed: re-observe with browser_snapshot before repeating it.
wait_timeout_msNoBound for wait_for_selector in milliseconds (default 8000, maximum 10000; 0 checks once). Requires wait_for_selector. Timeout preserves action success and returns current state. Use browser_snapshot with the same wait to re-observe without repeating an action.
wait_for_selectorNoWait for any visible element matching this CSS selector in the page, including open shadow roots (web components); child frames are not searched, and a timeout says how many were visible. On actions requires return_state=true. Returns readiness met, timeout or error; only this condition is checked, not general app readiness. Prefer a selector specific to the expected new UI.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.13.0

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already declare destructive and idempotent, and the description corroborates and enriches them: existing contents are replaced wholesale, events are trusted page-visible input, action works in an unfocused background tab, and the response reports exact-value verification with the actual value when the page truncated or altered it (except password fields). That verification and masking behavior is not derivable from annotations.

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 core action and its mechanism are front-loaded, followed by scope, reply semantics, and tool-routing guardrails; every sentence carries information. It is dense and long for a single tool, with several clauses packed into the first sentence, which keeps it just short of ideal.

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?

There is no output schema, yet the description explains what the reply contains (exact-match confirmation and observed value on modification, withheld for passwords), plus background-tab behavior and the trusted-event guarantee. For a mutating fill tool that is everything an agent needs to invoke it correctly and interpret the result.

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 coverage is 100%, so all seven parameters are already documented, including the empty-string semantics for text and the wrapper index rule. The description reinforces the index-source ('browser_snapshot index') and clearing behavior but adds no new syntax, units, or defaults beyond the schema, so the baseline of 3 applies.

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 precise verb and resource ('Replace the whole value of a text field') plus the mechanism (focus by browser_snapshot index, select-all, Chrome text input). It also delineates scope: input, textarea and contenteditable including open shadow roots, and background tabs. This clearly separates it from browser_type and the desktop typing tools.

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?

Explicit routing advice is given: use browser_type to insert at the caret, browser_request_credentials for passwords and codes, and never use desktop press_key/type_text on a Chrome tab because those target whichever window is frontmost. It also documents the empty-string clearing case and the wrapper-index edge case.

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