puppeteer_fill
Automate form filling by entering specified values into designated input fields using CSS selectors, streamlining web interactions via browser automation.
Instructions
Fill out an input field
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | CSS selector for input field | |
| value | Yes | Value to fill |
Implementation Reference
- src/tools/handlers.ts:161-180 (handler)The main handler logic for the puppeteer_fill tool. It waits for the specified selector to appear, types the provided value into the input field, and returns a success message or error if the operation fails.case "puppeteer_fill": try { await page.waitForSelector(args.selector); await page.type(args.selector, args.value); return { content: [{ type: "text", text: `Filled ${args.selector} with: ${args.value}`, }], isError: false, }; } catch (error) { return { content: [{ type: "text", text: `Failed to fill ${args.selector}: ${(error as Error).message}`, }], isError: true, }; }
- src/tools/definitions.ts:59-70 (schema)The tool schema definition specifying the input parameters: selector (CSS selector for the input field) and value (string to fill in).{ name: "puppeteer_fill", description: "Fill out an input field", inputSchema: { type: "object", properties: { selector: { type: "string", description: "CSS selector for input field" }, value: { type: "string", description: "Value to fill" }, }, required: ["selector", "value"], }, },
- src/server.ts:35-37 (registration)Registration of the ListToolsRequestHandler which exposes the puppeteer_fill tool schema as part of the TOOLS array.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS, }));
- src/server.ts:39-41 (registration)Registration of the CallToolRequestHandler which routes tool calls, including puppeteer_fill, to the handleToolCall function.server.setRequestHandler(CallToolRequestSchema, async (request) => handleToolCall(request.params.name, request.params.arguments ?? {}, state, server) );