Skip to main content
Glama

playwright_fill

Automatically populate an input field on a web page by specifying a CSS selector and the desired value, enabling precise browser automation with Playwright.

Instructions

fill out an input field

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector for input field
valueYesValue to fill

Implementation Reference

  • The FillTool class provides the core implementation of the playwright_fill tool, using Playwright's page.fill method after waiting for the selector.
    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}`);
        });
      }
    }
  • Input schema definition for the playwright_fill tool, specifying 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"],
      },
    },
  • Registration in the main tool handler switch statement, dispatching calls to the FillTool instance.
    case "playwright_fill":
      return await fillTool.execute(args, context);
  • Instantiation of the FillTool instance during tool initialization.
    if (!fillTool) fillTool = new FillTool(server);
  • Helper method in codegen generator to produce Playwright test code for fill actions.
    private generateFillStep(parameters: Record<string, unknown>): string {
      const { selector, value } = parameters;
      return `
      // Fill input field
      await page.fill('${selector}', '${value}');`;
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action but doesn't cover critical aspects like whether it waits for the selector to be visible, handles errors if the selector isn't found, or interacts with the page state. This leaves significant gaps in understanding how the tool behaves beyond the basic action.

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, direct phrase ('fill out an input field') that is highly concise and front-loaded with the core purpose. There is no wasted language or unnecessary elaboration, making it efficient and easy to parse.

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 the complexity of browser automation (implied by sibling tools) and the absence of annotations and output schema, the description is incomplete. It doesn't address behavioral nuances, error handling, or return values, which are crucial for effective tool use in this context. The high schema coverage helps but doesn't compensate for the lack of operational context.

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?

The input schema has 100% description coverage, clearly documenting both parameters ('selector' as CSS selector and 'value' as value to fill). The description adds no additional semantic context beyond what the schema provides, such as examples or constraints, so it meets the baseline for high schema coverage without enhancing parameter understanding.

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 out) and target (input field), which is specific and unambiguous. However, it doesn't distinguish this tool from its sibling 'playwright_iframe_fill', which likely serves a similar purpose for iframes, missing full sibling differentiation.

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?

The description provides no guidance on when to use this tool versus alternatives like 'playwright_iframe_fill' or other input-related tools. It lacks context about prerequisites, such as requiring a page to be loaded, or exclusions, making it minimally helpful for decision-making.

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

Related 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/executeautomation/mcp-playwright'

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