Skip to main content
Glama

browser_clear

Clears input field values in web browsers for automated testing and form resetting. Use this Selenium WebDriver tool to remove text from text boxes, search bars, and form inputs during browser automation.

Instructions

Clears the value of an input element

Input Schema

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

Implementation Reference

  • Registration of the 'browser_clear' tool, including the inline handler function that invokes ElementService.clearElement to clear the input element.
    server.tool(
      'browser_clear',
      'Clears the value of an input element',
      { ...locatorSchema },
      async ({ by, value, timeout = 15000 }) => {
        try {
          const driver = stateManager.getDriver();
          const elementService = new ElementService(driver);
          await elementService.clearElement({ by, value, timeout });
          return {
            content: [{ type: 'text', text: 'Element cleared' }],
          };
        } catch (e) {
          return {
            content: [
              {
                type: 'text',
                text: `Error clearing element: ${(e as Error).message}`,
              },
            ],
          };
        }
      }
  • Schema definition for locators used as input parameters for the browser_clear tool (by, value, timeout).
    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'),
    };
  • Core handler logic for clearing the element using Selenium WebDriver's element.clear() method.
    async clearElement(params: LocatorParams): Promise<void> {
      const element = await this.findElement(params);
      await element.clear();
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states what the tool does ('clears the value') but doesn't disclose behavioral traits like whether it waits for the element to be visible, what happens if the element isn't found, whether it triggers events, or what the return value is. For a mutation tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 target, making it immediately understandable 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?

Given this is a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't explain what happens on success/failure, whether it returns anything, or any side effects. With many sibling tools and complex browser interactions, more context about behavior and outcomes would be helpful for the agent.

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 documents all three parameters thoroughly. The description adds no parameter-specific information beyond what's in the schema. According to guidelines, when schema coverage is high (>80%), the baseline score is 3 even with no param info in the description.

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 ('clears') and target ('value of an input element'), making the purpose immediately understandable. It doesn't specifically differentiate from siblings like 'browser_type' (which inputs text) or 'browser_blur_element' (which removes focus), but the verb 'clears' is sufficiently distinct for most use cases.

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. With many sibling tools for browser interaction, there's no mention of when clearing an input is appropriate versus typing new text, deleting elements, or other related actions. The agent must infer usage from the name 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/pshivapr/selenium-mcp'

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