Skip to main content
Glama

playwright_fill

Fill input fields in web browsers using CSS selectors to automate form completion and data entry tasks with Playwright automation.

Instructions

fill out an input field

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector for input field
valueYesValue to fill

Implementation Reference

  • The FillTool class that provides the core handler implementation for the 'playwright_fill' tool. It waits for the selector and fills the input with the provided value using Playwright's page.fill method.
    export class FillTool extends BrowserToolBase {
      /**
       * Execute the fill tool
       */
      async execute(args: any, context: ToolContext): Promise<ToolResponse> {
        return this.safeExecute(context, async (page) => {
          await page.waitForSelector(args.selector);
          await page.fill(args.selector, args.value);
          return createSuccessResponse(`Filled ${args.selector} with: ${args.value}`);
        });
      }
    }
  • The tool schema definition for 'playwright_fill', including name, description, and input schema specifying required 'selector' and 'value' parameters.
      name: "playwright_fill",
      description: "fill out an input field",
      inputSchema: {
        type: "object",
        properties: {
          selector: { type: "string", description: "CSS selector for input field" },
          value: { type: "string", description: "Value to fill" },
        },
        required: ["selector", "value"],
      },
    },
  • The registration and dispatch point in the main tool handler switch statement, which calls the FillTool's execute method for 'playwright_fill'.
    case "playwright_fill":
      return await fillTool.execute(args, context);
  • Instantiation of the FillTool instance used for handling 'playwright_fill' tool calls.
    if (!fillTool) fillTool = new FillTool(server);
  • Import declaration for the FillTool class from the interaction module.
    FillTool,
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the action but lacks behavioral details such as whether it waits for the element to be visible, clears existing content first, handles validation, or requires specific page states. This is inadequate for a mutation tool with zero annotation coverage.

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?

The description is a single, efficient sentence with zero waste. It is appropriately sized for a simple tool and front-loaded with the core action, making it easy to scan and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and a mutation tool with behavioral complexity (e.g., potential side effects), the description is incomplete. It should address prerequisites, error conditions, or return values to help an agent use it correctly in context with other Playwright tools.

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 100%, with clear descriptions for both parameters (selector and value). The description adds no additional meaning beyond the schema, such as examples or constraints on selector syntax. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'fill out an input field' clearly states the action (fill) and target (input field) with a specific verb. It distinguishes from siblings like playwright_click or playwright_select by focusing on text input, though it doesn't explicitly differentiate from playwright_iframe_fill which serves a similar purpose in iframes.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives like playwright_type or playwright_set_input_value (if they existed in the sibling list). The description implies usage for input fields but doesn't specify prerequisites (e.g., page must be loaded) or exclusions (e.g., not for non-input elements).

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aakashH242/mcp-playwright'

If you have feedback or need assistance with the MCP directory API, please join our Discord server