Skip to main content
Glama

type

Enter text at the current cursor position in the browser, with an option to press Enter after typing.

Instructions

Type text at the current focus position

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesText to type
submitNoPress Enter after typing (default: false)

Implementation Reference

  • The main handler implementation for the 'type' tool. It types text at the current focus position with optional submission, validates inputs, and returns an observation result after typing.
    def _type(self, text: str = None, submit: bool = False, **_) -> BrowserResult:
        """Type text at current focus"""
        if not text:
            return BrowserResult(success=False, error="text required")
        
        if self._page is None:
            return BrowserResult(success=False, error="No page open")
        
        try:
            self._human_type(text)
            
            if submit:
                if self._humanize:
                    time.sleep(random.uniform(0.1, 0.3))
                self._page.keyboard.press("Enter")
                
                try:
                    self._page.wait_for_load_state("networkidle", timeout=5000)
                except:
                    pass
                self._page.wait_for_timeout(1000)
            else:
                self._page.wait_for_timeout(500)
            
            return self._observe()
            
        except Exception as e:
            return BrowserResult(
                success=False,
                error=f"Type failed: {str(e)}"
            )
  • Helper method that performs humanized typing with randomized delays between characters to simulate natural typing patterns.
    def _human_type(self, text: str):
        """Humanized typing"""
        if not self._humanize:
            self._page.keyboard.type(text)
            return
        
        for i, char in enumerate(text):
            delay = random.uniform(0.05, 0.15)
            
            if random.random() < 0.1:
                delay += random.uniform(0.15, 0.4)
            
            if i > 0 and text[i-1] == ' ':
                delay += random.uniform(0.05, 0.15)
            
            self._page.keyboard.type(char)
            time.sleep(delay)
  • Tool schema definition for the 'type' tool, defining input parameters (text and optional submit boolean) and their types.
    Tool(
        name="type",
        description="Type text at the current focus position",
        inputSchema={
            "type": "object",
            "properties": {
                "text": {
                    "type": "string",
                    "description": "Text to type"
                },
                "submit": {
                    "type": "boolean",
                    "description": "Press Enter after typing (default: false)",
                    "default": False
                }
            },
            "required": ["text"]
        }
    ),
  • Tool registration handler that routes 'type' tool calls to the browser.execute method with appropriate arguments.
    elif name == "type":
        result = await asyncio.to_thread(
            browser.execute,
            action="type",
            text=arguments.get("text"),
            submit=arguments.get("submit", False)
        )
  • Action mapping that registers the 'type' action name to its handler method _type within the execute method.
    actions = {
        "navigate": self._navigate,
        "observe": self._observe,
        "click": self._click,
        "multi_click": self._multi_click,
        "type": self._type,
        "scroll": self._scroll,
        "close": self._close
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While it mentions the typing action, it doesn't disclose important behavioral traits like whether this simulates keyboard events, what happens if no focus position exists, potential rate limits, or error conditions. The description provides only basic functional information without deeper behavioral context.

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, perfectly front-loaded sentence that communicates the core functionality without any wasted words. Every word earns its place, making it maximally efficient while still being complete for its length.

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

Completeness3/5

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

For a 2-parameter tool with no annotations and no output schema, the description provides adequate basic functionality but lacks completeness. It doesn't explain what happens after typing, potential side effects, error scenarios, or return values. While concise, it leaves important contextual gaps for a tool that interacts with UI focus states.

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 fully documents both parameters. The description doesn't add any parameter semantics beyond what's in the schema - it mentions typing text but doesn't elaborate on the 'text' parameter or 'submit' behavior. Baseline 3 is appropriate when the schema does all the parameter documentation work.

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

Purpose5/5

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

The description clearly states the specific action ('Type text') and target ('at the current focus position'), distinguishing it from sibling tools like click or navigate. It uses a precise verb+resource construction that leaves no ambiguity about what the tool does.

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

Usage Guidelines3/5

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

The description implies usage context ('at the current focus position') suggesting this tool should be used when there's already an active text input field, but it doesn't explicitly state when to use it versus alternatives or provide any exclusion criteria. No sibling tool comparisons or explicit guidance are provided.

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/LingTravel/Atlas-Browser'

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