Skip to main content
Glama
hrmeetsingh

MCP Browser Automation Server

by hrmeetsingh

playwright_fill

Automate browser tasks by filling input fields with specified values using CSS selectors, enabling streamlined interaction with web elements via the MCP Browser Automation Server.

Instructions

fill out an input field

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector for input field
valueYesValue to fill

Implementation Reference

  • Handler implementation for the playwright_fill tool. It waits for the selector to appear and then fills the input field with the provided value using Playwright's page.fill method.
    case "playwright_fill":
      try {
        await page!.waitForSelector(args.selector);
        await page!.fill(args.selector, args.value);
        return {
          toolResult: {
            content: [{
              type: "text",
              text: `Filled ${args.selector} with: ${args.value}`,
            }],
            isError: false,
          },
        };
      } catch (error) {
        return {
          toolResult: {
            content: [{
              type: "text",
              text: `Failed to type ${args.selector}: ${(error as Error).message}`,
            }],
            isError: true,
          },
        };
      }
  • Schema definition for the playwright_fill tool, specifying the input parameters selector and value.
    {
      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"],
      },
    },
  • src/index.ts:23-26 (registration)
    Registration of tools including playwright_fill via createToolDefinitions() and setupRequestHandlers.
    const TOOLS = createToolDefinitions();
    
    // Setup request handlers
    setupRequestHandlers(server, TOOLS);
  • Helper array BROWSER_TOOLS that includes playwright_fill, used to determine if browser launch is required.
    export const BROWSER_TOOLS = [
      "playwright_navigate",
      "playwright_screenshot",
      "playwright_click",
      "playwright_fill",
      "playwright_select",
      "playwright_hover",
      "playwright_evaluate"
    ];

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

C2.7/5.0
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 'fill out an input field' which implies a write operation, but doesn't disclose behavioral traits like whether it waits for the field to be visible, handles validation, triggers events, or has side effects. For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

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 phrase: 'fill out an input field'. It's front-loaded with the core action and target, with zero wasted words. Every part of the sentence directly contributes to understanding the tool's purpose.

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 a browser automation tool with no annotations and no output schema, the description is incomplete. It doesn't explain return values, error conditions, or interaction details. For a mutation tool in a Playwright context, more context on behavior and outcomes is needed to be fully helpful.

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 documentation for 'selector' (CSS selector) and 'value' (value to fill). The description doesn't add any meaning beyond this, such as examples or constraints. With high schema coverage, the baseline is 3, as the description doesn't compensate but also doesn't detract from the schema's information.

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

Purpose3/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), but it's vague about scope and doesn't differentiate from siblings like playwright_type or playwright_press_key that might handle similar input interactions. It specifies the resource but lacks precision about what 'fill' entails compared to other input methods.

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. With siblings like playwright_press_key (for keyboard input) and playwright_type (which might simulate typing), the description doesn't indicate if this is for direct value setting, form completion, or specific input types. There's no mention of prerequisites, context, or exclusions.

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

Deploy Server

Other Tools

Related Tools