puppeteer_select
Select options in dropdown menus on web pages using CSS selectors to automate form interactions and data entry in browser automation workflows.
Instructions
Select an element on the page with Select tag
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | CSS selector for element to select | |
| value | Yes | Value to select |
Implementation Reference
- src/tools/handlers.ts:182-201 (handler)Implements the puppeteer_select tool logic: waits for the CSS selector, selects the specified value using Puppeteer's page.select method, and returns a success or error message.case "puppeteer_select": try { await page.waitForSelector(args.selector); await page.select(args.selector, args.value); return { content: [{ type: "text", text: `Selected ${args.selector} with: ${args.value}`, }], isError: false, }; } catch (error) { return { content: [{ type: "text", text: `Failed to select ${args.selector}: ${(error as Error).message}`, }], isError: true, }; }
- src/tools/definitions.ts:71-82 (schema)Defines the tool schema including name, description, and input schema requiring 'selector' and 'value' parameters.{ name: "puppeteer_select", description: "Select an element on the page with Select tag", inputSchema: { type: "object", properties: { selector: { type: "string", description: "CSS selector for element to select" }, value: { type: "string", description: "Value to select" }, }, required: ["selector", "value"], }, },
- src/server.ts:35-41 (registration)Registers the MCP tool handlers: ListToolsRequestSchema returns the TOOLS list (including puppeteer_select), and CallToolRequestSchema dispatches to handleToolCall which handles puppeteer_select.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS, })); server.setRequestHandler(CallToolRequestSchema, async (request) => handleToolCall(request.params.name, request.params.arguments ?? {}, state, server) );