Skip to main content
Glama

browser_select_option

Destructive

Select values in dropdown menus during browser automation. Use this Playwright MCP tool to interact with web page dropdowns by specifying element references and desired values.

Instructions

Select an option in a dropdown

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
elementYesHuman-readable element description used to obtain permission to interact with the element
refYesExact target element reference from the page snapshot
valuesYesArray of values to select in the dropdown. This can be a single value or multiple values.

Implementation Reference

  • Implements the core logic for the browser_select_option tool: parses input using selectOptionSchema, locates the target element via snapshot reference, generates explanatory Playwright code snippet, performs the selectOption action on the locator, and returns the code.
    handle: async (context, params) => {
      const validatedParams = selectOptionSchema.parse(params);
      return await context.currentTab().runAndWaitWithSnapshot(async snapshot => {
        const locator = snapshot.refLocator(validatedParams.ref);
        const code = [
          `// Select options [${validatedParams.values.join(', ')}] in ${validatedParams.element}`,
          `await page.${await generateLocator(locator)}.selectOption(${javascript.formatObject(validatedParams.values)});`
        ];
        await locator.selectOption(validatedParams.values);
        return { code };
      });
    },
  • Defines the tool schema including name 'browser_select_option', description, and input schema derived from selectOptionSchema.
    schema: {
      name: 'browser_select_option',
      description: 'Select an option in a dropdown',
      inputSchema: zodToJsonSchema(selectOptionSchema),
    },
  • Zod type definition for the input schema of browser_select_option, extending shared elementSchema with 'values' array parameter.
    const selectOptionSchema = elementSchema.extend({
      values: z.array(z.string()).describe('Array of values to select in the dropdown. This can be a single value or multiple values.'),
    });
  • Registers the browser_select_option tool by including the selectOption object in the exported array of tools from this module.
    selectOption,
Behavior3/5

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

Annotations already indicate this is a destructive (destructiveHint: true), non-read-only (readOnlyHint: false), open-world operation (openWorldHint: true). The description adds that it selects 'an option in a dropdown,' which clarifies the specific UI interaction, but doesn't provide additional behavioral context like error handling, multi-select capabilities (implied by 'values' parameter), or side effects beyond what annotations cover.

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, direct sentence with no wasted words. It's front-loaded and efficiently communicates the core function without unnecessary elaboration, making it easy to parse quickly.

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 complexity (destructive UI interaction with 3 required parameters), annotations cover safety and scope, and schema fully describes inputs. However, without an output schema, the description doesn't explain return values or success/failure behavior. It's minimally complete but lacks details on outcomes or error cases.

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%, with clear descriptions for all three parameters (element, ref, values). The description adds minimal value beyond the schema, as it doesn't explain parameter relationships or usage examples. The baseline score of 3 is appropriate since the schema fully documents parameters.

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 an option in a dropdown' clearly states the action (select) and target resource (option in a dropdown), making the purpose immediately understandable. It distinguishes from siblings like browser_click or browser_type by specifying dropdown interaction, though it doesn't explicitly contrast with similar tools like browser_fill_form which might also handle dropdowns.

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. It doesn't mention prerequisites (e.g., needing a page snapshot from browser_snapshot first), nor does it differentiate from sibling tools like browser_fill_form that might handle form dropdowns. Usage context is implied but not stated.

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/markbustamante77/mcp'

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