puppeteer_fill
Automate filling input fields on web pages using CSS selectors and specified values, enabling precise browser interactions within the Puppeteer-based MCP server environment.
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
- index.ts:232-251 (handler)The handler function for the 'puppeteer_fill' tool. It waits for the specified selector, types the given value into the input field using Puppeteer, and returns a success or error message.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, }; }
- index.ts:55-66 (schema)The schema definition for the 'puppeteer_fill' tool, specifying the input parameters: selector (CSS selector for the input field) and value (string to fill). This is part of the TOOLS array used for tool listing.{ 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"], }, },
- index.ts:414-416 (registration)Registration of the tool call handler. The handleToolCall function, which contains the switch case for 'puppeteer_fill', is set as the handler for CallToolRequestSchema.server.setRequestHandler(CallToolRequestSchema, async (request) => handleToolCall(request.params.name, request.params.arguments ?? {}) );
- index.ts:411-412 (registration)Registration in ListToolsRequestSchema handler, returning the TOOLS array which includes the 'puppeteer_fill' tool definition.tools: TOOLS, }));