Skip to main content
Glama

browser_type

Enter text into web page input fields using Selenium WebDriver for browser automation and testing.

Instructions

Type into an editable field

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
byYesLocator strategy to find element
valueYesValue for the locator strategy
timeoutNoMaximum time to wait for element in milliseconds
textYesText to enter into the element

Implementation Reference

  • Registration of the 'browser_type' MCP tool. Includes input schema (extending locatorSchema with 'text' field) and the handler function that retrieves the WebDriver, instantiates ElementService, and calls sendKeysToElement.
    server.tool(
      'browser_type',
      'Type into an editable field',
      {
        ...locatorSchema,
        text: z.string().describe('Text to enter into the element'),
      },
      async ({ by, value, text, timeout = 15000 }) => {
        try {
          const driver = stateManager.getDriver();
          const elementService = new ElementService(driver);
          await elementService.sendKeysToElement({ by, value, text, timeout });
          return {
            content: [{ type: 'text', text: `Text "${text}" entered into element` }],
          };
        } catch (e) {
          return {
            content: [
              {
                type: 'text',
                text: `Error entering text: ${(e as Error).message}`,
              },
            ],
          };
        }
      }
    );
  • Helper method in ElementService that implements the core typing logic: finds the target element using the locator, clears it, and sends the provided text using Selenium WebDriver.
    async sendKeysToElement(params: LocatorParams & { text: string }): Promise<void> {
      const element = await this.findElement(params);
      await element.clear();
      await element.sendKeys(params.text);
    }
  • Base schema definition for element locators (by, value, timeout), which is spread into the browser_type tool's input schema.
    export const locatorSchema = {
      by: z
        .enum(['id', 'css', 'xpath', 'name', 'tag', 'class', 'link', 'partialLink'])
        .describe('Locator strategy to find element'),
      value: z.string().describe('Value for the locator strategy'),
      timeout: z.number().optional().describe('Maximum time to wait for element in milliseconds'),
    };
Behavior1/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 but fails completely. It doesn't mention whether this tool waits for the element to be interactable, what happens if the element isn't editable, whether it triggers events like 'input' or 'change', if it requires the element to be in focus first, or any error conditions. The description provides no behavioral context beyond the basic action implied by the name.

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 extremely concise at just four words with no wasted language. While it's under-specified in content, it's perfectly structured as a single, clear imperative phrase that's front-loaded with the core action.

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 this is a browser automation tool with 4 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what constitutes success or failure, what the tool returns, how it interacts with page state, or any behavioral nuances. For a tool that performs a potentially complex UI interaction, this minimal description leaves critical gaps in understanding.

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 already fully documents all four parameters (by, value, timeout, text) with descriptions and enum values. The description adds no parameter information beyond what's in the schema, so it meets the baseline of 3 where the schema does the heavy lifting without adding extra semantic value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Type into an editable field' is a tautology that essentially restates the tool name 'browser_type' without adding meaningful specificity. It doesn't distinguish this tool from similar sibling tools like 'browser_key_press' or 'browser_clear' that also involve text input interactions, nor does it specify what type of element or context it operates on beyond the vague 'editable field'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/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. There's no mention of prerequisites (e.g., requiring a focused element), comparison to sibling tools like 'browser_key_press' for simulated keystrokes or 'browser_clear' for clearing text, or any context about when this specific typing action is appropriate versus other input methods.

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/pshivapr/selenium-mcp'

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