Skip to main content
Glama

type_text

Enter text into input fields using CSS selectors to automate form filling during web testing and debugging workflows.

Instructions

Digita texto em um campo de input

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
clearFirstNoLimpar campo antes de digitar
selectorYesSeletor CSS do campo de input
textYesTexto para digitar

Implementation Reference

  • The handler function for the 'type_text' tool. It types text into a selector, optionally clearing first by triple-clicking, using Puppeteer's page.type and page.click methods.
    export async function handleTypeText(args: unknown, currentPage: Page): Promise<ToolResponse> {
      const typedArgs = args as unknown as TypeTextArgs;
      const { selector, text, clearFirst = true } = typedArgs;
    
      if (clearFirst) {
        await currentPage.click(selector, { clickCount: 3 });
      }
      await currentPage.type(selector, text);
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              success: true,
              message: `Texto digitado em: ${selector}`,
            }),
          },
        ],
      };
    }
  • TypeScript interface defining the input arguments for the type_text tool: selector (CSS selector for input field), text (string to type), clearFirst (optional boolean to clear field first).
    export interface TypeTextArgs {
      selector: string;
      text: string;
      clearFirst?: boolean;
    }
  • src/tools.ts:212-233 (registration)
    MCP tool registration in the tools array, including name, description, and inputSchema for validation.
      name: 'type_text',
      description: 'Digita texto em um campo de input',
      inputSchema: {
        type: 'object',
        properties: {
          selector: {
            type: 'string',
            description: 'Seletor CSS do campo de input',
          },
          text: {
            type: 'string',
            description: 'Texto para digitar',
          },
          clearFirst: {
            type: 'boolean',
            description: 'Limpar campo antes de digitar',
            default: true,
          },
        },
        required: ['selector', 'text'],
      },
    },
  • src/index.ts:107-110 (registration)
    Dispatch logic in the MCP server request handler that routes 'type_text' calls to the handleTypeText function, ensuring browser page is initialized.
    case 'type_text': {
      const currentPage = await initBrowser();
      return await handleTypeText(args, currentPage);
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions typing text but omits critical behavioral details: whether it simulates keystrokes or sets value, error handling for invalid selectors, timing/async behavior, or side effects. This is inadequate for a mutation tool with zero annotation coverage.

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, clear sentence in Portuguese with no wasted words. It's appropriately sized and front-loaded, directly stating the tool's core function without unnecessary elaboration.

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 mutation tool with no annotations and no output schema, the description is insufficient. It lacks details on behavioral traits, error conditions, or return values, leaving significant gaps in understanding how the tool operates in practice.

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 parameters are fully documented in the schema. The description adds no additional meaning beyond implying text input, aligning with the baseline score when the schema handles parameter documentation effectively.

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 'Digita texto em um campo de input' clearly states the action (type/digit) and target (input field) in Portuguese, making the purpose understandable. However, it doesn't differentiate from potential sibling tools like 'click_element' or 'execute_js' that might also interact with input fields, 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 provides no guidance on when to use this tool versus alternatives. With siblings like 'execute_js' or 'click_element' available, there's no indication of preferred contexts, prerequisites, or exclusions for text input operations.

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/EmmanuelBarbosaMonteiro/mcp-server-browser'

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