Skip to main content
Glama

browser_fill

Automatically populate form fields in web browsers using element selectors and specified values to streamline data entry tasks.

Instructions

Fill a form field

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instanceIdYesInstance ID
selectorYesElement selector
valueYesValue to fill
timeoutNoTimeout in milliseconds

Implementation Reference

  • The core handler function that executes the browser_fill tool logic using Playwright's page.fill method to fill a form field with the given value.
    private async fill(instanceId: string, selector: string, value: string, timeout: number): Promise<ToolResult> {
      const instance = this.browserManager.getInstance(instanceId);
      if (!instance) {
        return { success: false, error: `Instance ${instanceId} not found` };
      }
    
      try {
        await instance.page.fill(selector, value, { timeout });
        return {
          success: true,
          data: { selector, value, filled: true },
          instanceId
        };
      } catch (error) {
        return {
          success: false,
          error: `Fill failed: ${error instanceof Error ? error.message : error}`,
          instanceId
        };
      }
    }
  • Input schema definition for the browser_fill tool, specifying parameters like instanceId, selector, value, and timeout.
    inputSchema: {
      type: 'object',
      properties: {
        instanceId: {
          type: 'string',
          description: 'Instance ID'
        },
        selector: {
          type: 'string',
          description: 'Element selector',
        },
        value: {
          type: 'string',
          description: 'Value to fill',
        },
        timeout: {
          type: 'number',
          description: 'Timeout in milliseconds',
          default: 30000
        }
      },
      required: ['instanceId', 'selector', 'value']
    }
  • src/tools.ts:237-263 (registration)
    Tool registration in the getTools() method, defining name, description, and input schema for browser_fill.
    {
      name: 'browser_fill',
      description: 'Fill a form field',
      inputSchema: {
        type: 'object',
        properties: {
          instanceId: {
            type: 'string',
            description: 'Instance ID'
          },
          selector: {
            type: 'string',
            description: 'Element selector',
          },
          value: {
            type: 'string',
            description: 'Value to fill',
          },
          timeout: {
            type: 'number',
            description: 'Timeout in milliseconds',
            default: 30000
          }
        },
        required: ['instanceId', 'selector', 'value']
      }
    },
  • src/tools.ts:547-549 (registration)
    Dispatch/registration in the executeTools switch statement that routes browser_fill calls to the fill handler method.
    case 'browser_fill':
      return await this.fill(args.instanceId, args.selector, args.value, args.timeout || 30000);

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/sailaoda/concurrent-browser-mcp'

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