Skip to main content
Glama
blackwhite084

Playwright Server MCP

playwright_fill

Automatically populate web form fields using CSS selectors to input specified values for web automation tasks.

Instructions

Fill out an input field

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector for input field
valueYesValue to fill

Implementation Reference

  • The FillToolHandler class provides the core implementation for the 'playwright_fill' tool. It checks for an active session, retrieves the current page, locates the input element using the provided CSS selector, fills it with the specified value using Playwright's fill method, and returns a confirmation message.
    class FillToolHandler(ToolHandler): async def handle(self, name: str, arguments: dict | None) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: if not self._sessions: return [types.TextContent(type="text", text="No active session. Please create a new session first.")] session_id = list(self._sessions.keys())[-1] page = self._sessions[session_id]["page"] selector = arguments.get("selector") value = arguments.get("value") await page.locator(selector).fill(value) return [types.TextContent(type="text", text=f"Filled element with selector {selector} with value {value}")]
  • The JSON Schema for the 'playwright_fill' tool, defining required string inputs 'selector' (CSS selector for the input field) and 'value' (text to fill in), as returned by the list_tools handler.
    types.Tool( 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 'playwright_fill' tool by mapping its name to an instance of FillToolHandler in the tool_handlers dictionary, which is used by the @server.call_tool() handler to execute the tool.
    "playwright_fill": FillToolHandler(),

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/blackwhite084/playwright-plus-python-mcp'

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