Skip to main content
Glama

browser_type

Input text into web page elements using element selectors, supporting multiple parallel browser instances with configurable delays and timeouts.

Instructions

Type text into an element

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instanceIdYesInstance ID
selectorYesElement selector
textYesText to input
delayNoInput delay in milliseconds
timeoutNoTimeout in milliseconds

Implementation Reference

  • The handler function that implements the core logic of the 'browser_type' tool. It retrieves the browser instance, locates the target element by selector, and types the provided text using Playwright's page.type() method with optional delay and timeout.
    private async type(instanceId: string, selector: string, text: string, options: TypeOptions): Promise<ToolResult> { const instance = this.browserManager.getInstance(instanceId); if (!instance) { return { success: false, error: `Instance ${instanceId} not found` }; } try { const typeOptions: any = {}; if (options.delay) typeOptions.delay = options.delay; if (options.timeout) typeOptions.timeout = options.timeout; await instance.page.type(selector, text, typeOptions); return { success: true, data: { selector, text, typed: true }, instanceId }; } catch (error) { return { success: false, error: `Type failed: ${error instanceof Error ? error.message : error}`, instanceId }; } }
  • src/tools.ts:205-236 (registration)
    The tool registration object defining the 'browser_type' tool's name, description, and input schema. This is returned as part of the getTools() array for MCP tool discovery.
    { name: 'browser_type', description: 'Type text into an element', inputSchema: { type: 'object', properties: { instanceId: { type: 'string', description: 'Instance ID' }, selector: { type: 'string', description: 'Element selector', }, text: { type: 'string', description: 'Text to input', }, delay: { type: 'number', description: 'Input delay in milliseconds', default: 0 }, timeout: { type: 'number', description: 'Timeout in milliseconds', default: 30000 } }, required: ['instanceId', 'selector', 'text'] } },
  • TypeScript interface defining the options structure (delay and timeout) used in the browser_type tool handler, matching the inputSchema properties.
    export interface TypeOptions { delay?: number; timeout?: number; }
  • The switch case dispatcher in executeTools() method that routes calls to the browser_type tool to the specific type() handler.
    case 'browser_type': return await this.type(args.instanceId, args.selector, args.text, { delay: args.delay || 0, timeout: 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