Skip to main content
Glama

browser_fill

Automate form filling by entering specified text into a targeted web input field using a CSS selector, streamlining repetitive data entry tasks in browser automation workflows.

Instructions

Fill a form input with text

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector for input field
valueYesText to enter in the field

Implementation Reference

  • The handler function for 'browser_fill' tool. It waits for the CSS selector to appear, fills the input field with the specified value using Playwright's page.fill(), and returns a success message or error.
    async function handleBrowserFill(page: Page, args: any): Promise<{ toolResult: CallToolResult }> {
      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: `Fill operation failed on ${args.selector}: ${(error as Error).message}`,
            }],
            isError: true,
          },
        };
      }
    }
  • src/tools.ts:84-95 (registration)
    Registration of the 'browser_fill' tool in the registerTools() function, including name, description, and input schema.
    {
      name: "browser_fill",
      description: "Fill a form input with text",
      inputSchema: {
        type: "object",
        properties: {
          selector: { type: "string", description: "CSS selector for input field" },
          value: { type: "string", description: "Text to enter in the field" }
        },
        required: ["selector", "value"]
      }
    },
  • Input schema for the 'browser_fill' tool defining the required selector (CSS selector for input) and value (text to enter).
    inputSchema: {
      type: "object",
      properties: {
        selector: { type: "string", description: "CSS selector for input field" },
        value: { type: "string", description: "Text to enter in the field" }
      },
      required: ["selector", "value"]
    }
  • Dispatch/registration case in the executeToolCall switch statement that calls the handleBrowserFill handler for 'browser_fill'.
    case "browser_fill":
      return await handleBrowserFill(activePage!, args);
  • src/tools.ts:7-7 (registration)
    'browser_fill' included in BROWSER_TOOLS constant array, used to identify browser tools in executor.
    "browser_fill",
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action but doesn't cover critical aspects like whether it requires the element to be visible, if it triggers events, error handling for invalid selectors, or performance implications. This leaves significant gaps for an agent to understand how to use it effectively.

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 that directly states the tool's function without any fluff or unnecessary words. It's appropriately sized and front-loaded, making it easy to parse 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 the complexity of browser automation (interacting with dynamic web elements) and the lack of annotations or output schema, the description is insufficient. It doesn't address success/failure conditions, return values, or edge cases (e.g., handling disabled inputs), leaving the agent with incomplete information for reliable use.

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 schema has 100% coverage with clear descriptions for both parameters (selector and value), so the description doesn't need to add parameter details. The description implies the parameters but doesn't provide additional semantic context beyond what the schema already documents, meeting the baseline for high schema coverage.

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 a form input with text' clearly states the action (fill) and target (form input), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like browser_select (which might also interact with form inputs) or specify what types of form inputs it works with beyond the generic term.

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 browser_click or browser_select, nor does it mention prerequisites such as needing a page to be loaded first. It's a standalone statement without context about its appropriate application scenarios.

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/imprvhub/mcp-browser-agent'

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