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(),
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden but provides minimal behavioral context. It doesn't disclose if this requires page interaction permissions, whether it waits for elements, if it handles errors like missing selectors, or what happens on success/failure. 'Fill out' implies a write operation, but no safety or side-effect details are given.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's appropriately sized for a simple tool and front-loaded with the core action, though it could benefit from more detail given the lack of annotations.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a write operation with no annotations and no output schema), the description is incomplete. It doesn't explain return values, error conditions, or behavioral nuances like waiting or validation. For a mutation tool in a browser automation context, this leaves significant gaps for an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters (selector and value). The description adds no additional meaning beyond what's in the schema, such as examples or constraints (e.g., selector must target an input element). Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Fill out an input field' states a clear action (fill) and target (input field), but it's vague about scope and doesn't distinguish from siblings like playwright_click_text (which might also interact with inputs). It doesn't specify whether this works for all input types or just text fields.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., page must be loaded), exclusions (e.g., not for dropdowns), or comparisons with siblings like playwright_click (for buttons) or playwright_evaluate (for custom scripts).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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