browser_select_option
Selects specified values from dropdown or multi-select elements in browser automation sessions. Use this tool to interact with form elements during web testing or data extraction workflows.
Instructions
Select option
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| element | Yes | ||
| ref | Yes | ||
| values | Yes |
Implementation Reference
- index.js:407-415 (registration)Tool registration for 'browser_select_option', which uses proxyToolCall to delegate the execution.
server.tool('browser_select_option', 'Select option', { element: z.string(), ref: z.string(), values: z.array(z.string()) }, async (args) => { const check = requireActivePage(); if (check) return check; return proxyToolCall('browser_select_option', args); }); - index.js:209-237 (helper)The proxyToolCall function acts as the bridge for tool execution by delegating the call to the underlying MCP client instance.
async function proxyToolCall(toolName, args) { log(`[proxyToolCall] ${toolName} with args: ${JSON.stringify(args)}`); const { client } = await getOrCreateInstance(); log(`[proxyToolCall] got client for port ${assignedPort}`); // Update last used if (assignedPort && instances.has(assignedPort)) { instances.get(assignedPort).lastUsed = Date.now(); } try { log(`[proxyToolCall] Calling client.callTool...`); const result = await client.callTool({ name: toolName, arguments: args || {} }); log(`[proxyToolCall] Result type: ${typeof result}`); log(`[proxyToolCall] Result: ${JSON.stringify(result).slice(0, 500)}`); // The SDK returns { content: [...], isError?: boolean } // We need to return this same format if (result && result.content) { return result; } // Fallback: wrap in content array if needed return { content: [{ type: 'text', text: JSON.stringify(result) }] }; } catch (error) { log(`[proxyToolCall] ERROR: ${error.message}\n${error.stack}`); return {