Skip to main content
Glama

browser_select_dropdown_by_value

Selects a specific option from a dropdown menu in a web browser using its value attribute. This tool helps automate form filling and UI testing by targeting dropdown elements with precision.

Instructions

Select dropdown by value

Input Schema

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

Implementation Reference

  • Core handler function that locates the dropdown element using LocatorFactory, waits for it to be present, instantiates Selenium's Select class, and selects the option by its value attribute.
    async selectDropdownByValue(params: LocatorParams & { value: string }): Promise<void> {
      const locator = LocatorFactory.createLocator(params.by, params.value);
      const selectElement = await this.driver.wait(until.elementLocated(locator), params.timeout || 15000);
      const select = new Select(selectElement);
      await select.selectByValue(params.value);
    }
  • Registers the MCP tool 'browser_select_dropdown_by_value' using McpServer.tool(), defines input schema extending locatorSchema (with value overridden for option value), and provides a thin async handler that instantiates ActionService and delegates execution.
    server.tool(
      'browser_select_dropdown_by_value',
      'Select dropdown by value',
      {
        ...locatorSchema,
        value: z.string().describe('Value of the option to select'),
      },
      async ({ by, value, timeout = 15000 }) => {
        try {
          const driver = stateManager.getDriver();
          const actionService = new ActionService(driver);
          await actionService.selectDropdownByValue({ by, value, timeout });
          return {
            content: [
              {
                type: 'text',
                text: `Selected dropdown option by value: ${value}`,
              },
            ],
          };
        } catch (e) {
          return {
            content: [
              {
                type: 'text',
                text: `Error selecting dropdown option by value: ${(e as Error).message}`,
              },
            ],
          };
        }
      }
  • Zod schema defining the base locator parameters (by, value, optional timeout), which is spread into the 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 full burden for behavioral disclosure but offers none. It doesn't indicate whether this is a read or write operation, what happens if the dropdown isn't found or the value doesn't exist, whether it waits for page loads, or any error conditions. The description is purely functional without behavioral context.

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 maximally concise at just three words with zero waste. It's front-loaded with the core action and doesn't contain any unnecessary verbiage. While under-specified, it's structurally efficient.

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 browser automation tool with 3 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain what 'selecting by value' means operationally, how it differs from text selection, what happens after selection, or any behavioral aspects. The agent would struggle to use this correctly without additional context.

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 additional meaning about parameters beyond what's in the schema - it doesn't explain the relationship between 'by' and 'value' parameters or provide examples. Baseline 3 is appropriate when schema does the heavy lifting.

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 'Select dropdown by value' is essentially a tautology that restates the tool name with minimal elaboration. It specifies the action ('select') and resource ('dropdown') but lacks specificity about what 'by value' means compared to other selection methods, and doesn't distinguish it from sibling tools like 'browser_select_dropdown_by_text'.

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. It doesn't mention the sibling tool 'browser_select_dropdown_by_text' or explain when selecting by value is preferable to selecting by text, nor does it provide any context about prerequisites or appropriate scenarios for this operation.

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