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
      });
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action but doesn't mention what happens if the element isn't found (timeout behavior), whether it simulates keystrokes or sets value, or any side effects. The description is minimal and lacks critical operational details.

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, clear sentence with zero wasted words. It's front-loaded with the core action and efficiently communicates the essential purpose without unnecessary elaboration.

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?

For a tool with 5 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain return values, error conditions, or behavioral nuances like how delays work or what happens on timeout. The agent would need to guess critical aspects of tool behavior.

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%, so the schema fully documents all parameters. The description adds no additional meaning beyond implying that 'text' is typed into an element identified by 'selector'. This meets the baseline for high schema coverage but doesn't enhance understanding.

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 clearly states the action ('Type text') and target ('into an element'), making the purpose immediately understandable. It distinguishes itself from siblings like browser_click (clicking) and browser_fill (filling forms), though it doesn't explicitly differentiate from browser_fill which might have overlapping functionality.

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_fill or browser_select_option. It doesn't mention prerequisites (e.g., needing an existing browser instance) or typical use cases, leaving the agent to infer usage from context alone.

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

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