puppeteer_select
Select an option in a dropdown list using a CSS selector and a value.
Instructions
Select an element on the page with Select tag
Input 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)The handler case for 'puppeteer_select' which waits for the selector, then performs page.select() with the provided selector and value.
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)The tool definition/schema for 'puppeteer_select' including name, description, and inputSchema (selector, value).
{ 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:34-37 (registration)Registration of all tools (including puppeteer_select) via ListToolsRequestSchema handler using the TOOLS array.
// Setup tool handlers server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS, })); - src/server.ts:39-41 (registration)Registration of the CallToolRequestSchema handler which dispatches tool calls (including puppeteer_select) to handleToolCall.
server.setRequestHandler(CallToolRequestSchema, async (request) => handleToolCall(request.params.name, request.params.arguments ?? {}, state, server) );