Skip to main content
Glama

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
NameRequiredDescriptionDefault
selectorYesCSS selector for input field
valueYesValue to fill

Implementation Reference

  • 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, }; }
  • 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"], }, },
  • 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, }));
  • 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) );
  • 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" ];

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lars-hagen/mcp-playwright-cdp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server