Skip to main content
Glama

browser_blur_element

Remove focus from web page elements during automation testing to simulate user interactions and validate UI behavior without active selection.

Instructions

Remove focus from a specific 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

  • Core implementation that locates the element using the provided locator and executes JavaScript to remove focus (blur) from it using Selenium WebDriver.
    async blurElement(params: LocatorParams): Promise<void> {
      const locator = LocatorFactory.createLocator(params.by, params.value);
      const element = await this.driver.wait(until.elementLocated(locator), params.timeout || 15000);
      await this.driver.executeScript('arguments[0].blur();', element);
    }
  • Registers the MCP tool 'browser_blur_element' with the server, defining its description, input schema (locator), and handler function that instantiates ActionService and calls blurElement.
    server.tool(
      'browser_blur_element',
      'Remove focus from a specific element',
      { ...locatorSchema },
      async ({ by, value }) => {
        try {
          const driver = stateManager.getDriver();
          const actionService = new ActionService(driver);
          await actionService.blurElement({ by, value });
          return {
            content: [{ type: 'text', text: `Removed focus from element` }],
          };
        } catch (e) {
          return {
            content: [
              {
                type: 'text',
                text: `Error removing focus from element: ${(e as Error).message}`,
              },
            ],
          };
        }
      }
    );
  • Zod schema defining the input parameters for locating elements (by strategy, value, optional timeout), used in the tool's input validation.
    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'),
    };
  • Calls registerActionTools within registerAllTools, which includes the registration of browser_blur_element among other action tools.
    registerActionTools(server, stateManager);
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 explain what 'blur' means in practical terms (e.g., triggers blur events, removes visual focus indicators), potential side effects, error conditions, or what happens if the element isn't currently focused. For a mutation tool with zero annotation coverage, this is insufficient.

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, efficient sentence that directly states the tool's purpose with zero wasted words. It's appropriately sized for a simple action tool and front-loads the essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (interactive element manipulation), no annotations, no output schema, and 100% schema coverage, the description is minimally adequate. It states what the tool does but lacks behavioral context, usage guidance, and output information. For a mutation tool in a browser automation context, more completeness would be expected.

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 three parameters (locator strategy, value, and timeout). The description adds no parameter-specific information beyond what's in the schema. According to scoring rules, when schema coverage is high (>80%), the baseline 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 ('Remove focus') and target ('from a specific element'), which is specific and unambiguous. It distinguishes itself from siblings like 'browser_focus_element' by performing the opposite action. However, it doesn't explicitly mention the browser context or differentiate from other interaction tools beyond the obvious focus-related ones.

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

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when an element has focus and needs to be blurred, but provides no explicit guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., element must be focused first), edge cases, or relationships with other tools like 'browser_focus_element' beyond the obvious inverse relationship.

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