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",
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