Skip to main content
Glama

session_fill_selector

Fill a text field by CSS selector on the current browser session page, correctly updating React/Vue-controlled inputs.

Instructions

Fill a text field on the session's current page, located by a CSS selector.

Uses Playwright's fill(), which drives React/Vue-controlled inputs correctly (setting the DOM value directly does not). Requires a session opened with profile_start first. selector is a CSS selector, not an XPath.

Args: name: identity name, exactly as profiles_list reports it. selector: CSS selector for the input to fill. text: the text to put in the field, replacing whatever was there. nth: optional, 0-based — which element to use when the selector matches several (see session_click_selector).

Returns {ok: true}. Fails with a readable message if the session is not open (409 — call profile_start first), the identity does not exist (404), the selector matches several elements and no nth was given, or the selector never matches / the fill times out (502).

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": {
      "name": "<name>",
      "selector": "<selector>",
      "text": "<text>"
    },
    "name": "session_fill_selector"
  }
}

Input Schema

NameRequiredDescriptionDefault
nthNo
nameYes
textYes
selectorYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.1.7
    • addedInput schema / properties / nth
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "integer"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Nth"
      +}
  2. First observedv0.1.5

TDQS

A4.2/5.0
Behavior4/5

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

No annotations, so the description carries the full burden and does most of it well: it discloses that Playwright fill() is used and why (React/Vue-controlled inputs), that existing text is replaced, and enumerates failure modes with HTTP codes (409 not open, 404 unknown identity, ambiguous selector, 502 timeout). What's missing is any note on permissions or side effects beyond the field mutation, keeping it just short of the top mark.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The lead sentence is well front-loaded, but the Args/Returns block restates parameter names already present in the schema and repeats failure conditions across both prose and returns, adding some redundancy for a four-parameter tool.

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?

With no output schema, the description supplies the return contract ({ok: true}) and the error taxonomy, and it covers the session prerequisite. It is essentially complete for an agent to call it correctly, with only permission/auth context absent.

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 description coverage is 0%, so the description must compensate, and it defines all four parameters: name as the identity name matching profiles_list, selector as CSS (not XPath), text as a replacement value, and nth as 0-based disambiguation for multi-match selectors. Only the exact error surface of an out-of-range nth is left unstated.

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 and resource — 'Fill a text field on the session's current page' — and adds the locating mechanism (CSS selector), which cleanly separates it from siblings like session_click_selector and session_press.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit prerequisite: 'Requires a session opened with profile_start first,' and it clarifies the selector is CSS not XPath. It points to session_click_selector for the nth semantics but doesn't state when a caller should prefer other input methods (e.g. press vs fill).

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