Skip to main content
Glama
epi-builder
by epi-builder

browser_type

Enter text into web page elements during browser automation by specifying the target element and text content.

Instructions

Type text into an element

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
elementYesHuman-readable element description
refYesExact target element reference from page snapshot
textYesText to type into the element

Implementation Reference

  • The handler function that executes the browser_type tool. It ensures the browser and page are ready, then types the provided text into the current page using Playwright's keyboard.type method, and returns a success message.
    private async handleType(element: string, ref: string, text: string) {
      await this.ensureBrowser();
      
      // Simple type implementation
      await this.browserState.page!.keyboard.type(text);
      
      return {
        content: [
          {
            type: 'text',
            text: `Typed "${text}" into ${element}`,
          },
        ],
      };
    }
  • The schema definition for the browser_type tool, including name, description, and input schema specifying element, ref, and text parameters.
      name: 'browser_type',
      description: 'Type text into an element',
      inputSchema: {
        type: 'object',
        properties: {
          element: {
            type: 'string',
            description: 'Human-readable element description',
          },
          ref: {
            type: 'string',
            description: 'Exact target element reference from page snapshot',
          },
          text: {
            type: 'string',
            description: 'Text to type into the element',
          },
        },
        required: ['element', 'ref', 'text'],
      },
    },
  • src/server.ts:166-168 (registration)
    The switch case registration that dispatches calls to the browser_type tool to the handleType handler function.
    case 'browser_type':
      return await this.handleType(args?.element as string, args?.ref as string, args?.text as string);
  • src/server.ts:57-149 (registration)
    The tool list registration in the ListToolsRequestSchema handler that includes the browser_type tool in the available tools list.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          {
            name: 'browser_navigate',
            description: 'Navigate to a URL',
            inputSchema: {
              type: 'object',
              properties: {
                url: {
                  type: 'string',
                  description: 'The URL to navigate to',
                },
              },
              required: ['url'],
            },
          },
          {
            name: 'browser_snapshot',
            description: 'Capture accessibility snapshot of the current page',
            inputSchema: {
              type: 'object',
              properties: {},
            },
          },
          {
            name: 'browser_click',
            description: 'Click on an element',
            inputSchema: {
              type: 'object',
              properties: {
                element: {
                  type: 'string',
                  description: 'Human-readable element description',
                },
                ref: {
                  type: 'string',
                  description: 'Exact target element reference from page snapshot',
                },
              },
              required: ['element', 'ref'],
            },
          },
          {
            name: 'browser_type',
            description: 'Type text into an element',
            inputSchema: {
              type: 'object',
              properties: {
                element: {
                  type: 'string',
                  description: 'Human-readable element description',
                },
                ref: {
                  type: 'string',
                  description: 'Exact target element reference from page snapshot',
                },
                text: {
                  type: 'string',
                  description: 'Text to type into the element',
                },
              },
              required: ['element', 'ref', 'text'],
            },
          },
          {
            name: 'browser_take_screenshot',
            description: 'Take a screenshot of the current page',
            inputSchema: {
              type: 'object',
              properties: {
                filename: {
                  type: 'string',
                  description: 'File name to save the screenshot to',
                },
                fullPage: {
                  type: 'boolean',
                  description: 'Take screenshot of full page',
                },
              },
            },
          },
          {
            name: 'browser_close',
            description: 'Close the browser',
            inputSchema: {
              type: 'object',
              properties: {},
            },
          },
        ] as Tool[],
      };
    });
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 offers minimal behavioral context. It states what the tool does but doesn't disclose important traits like whether it simulates human typing speed, handles special keys, validates element existence, or what happens on failure. 'Type text into an element' implies a write operation but lacks details about side effects or error conditions.

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 extremely concise with a single, direct sentence that states the core functionality without any wasted words. It's front-loaded and efficiently communicates the essential action.

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 browser automation tool with 3 required parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain the relationship between 'element' and 'ref' parameters, what happens after typing, error handling, or how it integrates with other browser tools. The context signals indicate this is part of a browser automation suite, but the description doesn't leverage that context.

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 all three parameters (element, ref, text) with clear descriptions. The description adds no additional meaning about parameters beyond what's in the schema, maintaining the baseline score for high schema coverage.

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 element'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like browser_click (which interacts with elements differently) or explain its unique role in the browser automation suite.

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 about when to use this tool versus alternatives. The description doesn't mention prerequisites (like needing a page snapshot from browser_snapshot), when typing is appropriate versus clicking, or how it relates to other browser tools in the workflow.

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/epi-builder/mcp-test'

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