Skip to main content
Glama

browser_select_option

Automates the selection of dropdown options in web accessibility scans, ensuring accurate interaction with specific elements for WCAG compliance testing. Ideal for precise dropdown value validation.

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

  • Defines the Zod input schema and tool metadata (name, title, description, type) for the browser_select_option tool. It extends the shared elementSchema with a '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.'), }); const selectOption = defineTabTool({ capability: 'core', schema: { name: 'browser_select_option', title: 'Select option', description: 'Select an option in a dropdown', inputSchema: selectOptionSchema, type: 'destructive', },
  • The core handler function that executes the tool. It resolves the element locator from the provided ref, generates equivalent Playwright code for the response, includes a page snapshot, and performs the selectOption action on the locator using the provided values.
    handle: async (tab, params, response) => { response.setIncludeSnapshot(); const locator = await tab.refLocator(params); response.addCode(`await page.${await generateLocator(locator)}.selectOption(${javascript.formatObject(params.values)});`); await tab.waitForCompletion(async () => { await locator.selectOption(params.values); }); }, });
  • Registers the browser tools (including browser_select_option) by initializing the tools list via filteredTools(config) in the BrowserServerBackend, which provides them to the MCP server via listTools() and callTool().
    this._tools = filteredTools(config); }
  • src/tools.ts:38-56 (registration)
    Aggregates all browser tool modules, including snapshot.ts which defines browser_select_option, into the allTools array. filteredTools filters this list based on config for the backend.
    export const allTools: Tool<any>[] = [ ...common, ...console, ...dialogs, ...evaluate, ...files, ...form, ...install, ...keyboard, ...navigate, ...network, ...mouse, ...pdf, ...screenshot, ...snapshot, ...tabs, ...wait, ...verify, ];

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/JustasMonkev/mcp-accessibility-scanner'

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