playwright_fill
Fill web form fields with specified values using CSS selectors for browser automation tasks.
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/toolsHandler.ts:208-228 (handler)Handler implementation for the playwright_fill tool using Playwright's page.fill method after waiting for the selector.case "playwright_fill": try { await page!.waitForSelector(args.selector); await page!.fill(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 type ${args.selector}: ${(error as Error).message}`, }], isError: true, }; }
- src/tools.ts:48-59 (schema)Input schema definition for the playwright_fill tool, specifying selector and value parameters.{ name: "playwright_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/requestHandler.ts:59-62 (registration)Registration of the list tools handler, which provides all tool definitions including playwright_fill schema to the MCP server.// List tools handler server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: tools, }));
- src/requestHandler.ts:65-67 (registration)Registration of the call tool handler that routes tool calls, including playwright_fill, to the handleToolCall function.server.setRequestHandler(CallToolRequestSchema, async (request) => handleToolCall(request.params.name, request.params.arguments ?? {}, server) );
- src/tools.ts:156-164 (helper)BROWSER_TOOLS array listing browser-requiring tools, including playwright_fill, used to conditionally launch browser.export const BROWSER_TOOLS = [ "playwright_navigate", "playwright_screenshot", "playwright_click", "playwright_fill", "playwright_select", "playwright_hover", "playwright_evaluate" ];