Skip to main content
Glama

playwright_fill

Fill input fields on web pages using CSS selectors and specified values. Enables precise browser automation for completing forms or updating text fields programmatically.

Instructions

fill out an input field

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector for input field
valueYesValue to fill

Implementation Reference

  • The handler function that implements the 'playwright_fill' tool logic: waits for the CSS selector to appear, fills the input field with the provided value, and returns a success or error message.
    case "playwright_fill": try { await page!.waitForSelector(args.selector); await page!.fill(args.selector, args.value); return { toolResult: { content: [{ type: "text", text: `Filled ${args.selector} with: ${args.value}`, }], isError: false, }, }; } catch (error) { return { toolResult: { content: [{ type: "text", text: `Failed to type ${args.selector}: ${(error as Error).message}`, }], isError: true, }, }; }
  • The tool definition including name, description, and input schema for 'playwright_fill', requiring 'selector' and 'value' as strings.
    { 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"], }, },
  • The 'playwright_fill' tool is listed in BROWSER_TOOLS array, used to conditionally launch the browser before executing browser-interacting tools.
    export const BROWSER_TOOLS = [ "playwright_navigate", "playwright_screenshot", "playwright_click", "playwright_fill", "playwright_select", "playwright_hover", "playwright_evaluate" ];
  • Registration of tool handlers: lists all tools (including 'playwright_fill') via ListToolsRequestSchema and routes tool calls to the handleToolCall function.
    // List tools handler server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: tools, })); // Call tool handler server.setRequestHandler(CallToolRequestSchema, async (request) => handleToolCall(request.params.name, request.params.arguments ?? {}, server) ); }

Other Tools

Related Tools

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/lebrodus/mcp-playwright'

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