Skip to main content
Glama

browser_select_dropdown_by_text

Selects a dropdown option by its visible text in web automation. Use this tool to interact with dropdown menus by specifying the element locator and the text to select.

Instructions

Select dropdown by visible text

Input Schema

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

Implementation Reference

  • Core implementation of the dropdown selection by visible text using Selenium's Select class. Locates the dropdown element and selects the option matching the provided text.
    async selectDropdownByText(params: LocatorParams & { text: 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.selectByVisibleText(params.text);
    }
  • Registers the MCP tool 'browser_select_dropdown_by_text' with input schema (locator + text) and a handler that delegates to ActionService.
    server.tool(
      'browser_select_dropdown_by_text',
      'Select dropdown by visible text',
      {
        ...locatorSchema,
        text: z.string().describe('Visible text of the option to select'),
      },
      async ({ by, value, text, timeout = 15000 }) => {
        try {
          const driver = stateManager.getDriver();
          const actionService = new ActionService(driver);
          await actionService.selectDropdownByText({ by, value, text, timeout });
          return {
            content: [{ type: 'text', text: `Selected dropdown option by text: ${text}` }],
          };
        } catch (e) {
          return {
            content: [
              {
                type: 'text',
                text: `Error selecting dropdown option by text: ${(e as Error).message}`,
              },
            ],
          };
        }
      }
    );
  • Zod schema defining the locator parameters (by, value, timeout) extended in the tool 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'),
    };
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the basic action. It doesn't disclose behavioral traits like error handling (e.g., what happens if text isn't found), side effects, or interaction specifics (e.g., whether it clicks or uses keyboard).

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 with zero waste. It's front-loaded and appropriately sized for the tool's complexity.

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 4 parameters, no annotations, and no output schema, the description is incomplete. It lacks context on behavior, error cases, and interaction details, leaving significant gaps for an AI agent to understand proper invocation.

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 parameters. The description adds no additional meaning beyond implying 'text' is for visible option selection, which is already clear from the schema. Baseline 3 is appropriate as the schema does the heavy lifting.

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 'Select dropdown by visible text' clearly states the action (select) and target (dropdown) with the method (by visible text). It distinguishes from sibling 'browser_select_dropdown_by_value' by specifying 'text' vs 'value', but doesn't explicitly mention this distinction in the description itself.

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?

No guidance is provided on when to use this tool versus alternatives like 'browser_select_dropdown_by_value'. The description implies usage for dropdown selection by text, but lacks explicit context, prerequisites, or exclusions.

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