Skip to main content
Glama

type

Enter text into web form fields using CSS selectors to automate browser interactions for testing or data entry tasks.

Instructions

Type text into an input element

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYes
textYes
page_idNo

Implementation Reference

  • Handler logic for the 'type' tool: validates arguments, gets the page, calls page.fill(selector, text), and returns a confirmation message.
    elif name == "type":
        selector = arguments.get("selector")
        text = arguments.get("text")
        if not selector or text is None:
            raise ValueError("Selector and text are required")
            
        page = get_active_page(arguments.get("page_id"))
        await page.fill(selector, text)
        return [types.TextContent(type="text", text=f"Typed '{text}' into {selector}")]
  • Registration of the 'type' tool in the handle_list_tools() function, including name, description, and input schema.
    types.Tool(
        name="type",
        description="Type text into an input element",
        inputSchema={
            "type": "object",
            "properties": {
                "selector": {"type": "string"},
                "text": {"type": "string"},
                "page_id": {"type": "string"},
            },
            "required": ["selector", "text"],
        },
    ),
  • Input schema definition for the 'type' tool, specifying required selector and text parameters.
    inputSchema={
        "type": "object",
        "properties": {
            "selector": {"type": "string"},
            "text": {"type": "string"},
            "page_id": {"type": "string"},
        },
        "required": ["selector", "text"],
    },
  • Helper function used by the 'type' handler to retrieve the active Playwright Page instance.
    def get_active_page(page_id: Optional[str] = None) -> Page:
        """Get the active page based on page_id or current default."""
        global current_page_id
        
        if page_id is None:
            page_id = current_page_id
        
        if page_id not in pages:
            raise ValueError(f"Page not found: {page_id}")
        
        return pages[page_id]
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the basic action without behavioral details. It doesn't disclose potential side effects (e.g., triggering events), error conditions (e.g., if selector fails), or performance aspects (e.g., timing), leaving significant gaps for a mutation tool.

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 directly states the tool's function without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly.

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?

For a 3-parameter mutation tool with no annotations and no output schema, the description is incomplete. It lacks details on behavior, parameters, error handling, and expected outcomes, leaving too many gaps for effective agent use despite the concise structure.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate but adds no parameter information. It doesn't explain what 'selector', 'text', or 'page_id' mean, their formats, or how they interact, failing to provide meaningful semantics beyond the bare schema.

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

Purpose4/5

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

The description clearly states the action ('type text') and target ('into an input element'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'click' or 'get_text' that might also interact with input elements, preventing a perfect score.

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?

The description offers no guidance on when to use this tool versus alternatives like 'click' for button interactions or 'get_text' for reading input values. It lacks context about prerequisites (e.g., needing a page loaded) or exclusions, leaving usage unclear.

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/misanthropic-ai/playwrite-mcp'

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