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); }

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