Skip to main content
Glama

browser_type

Simulate text input into editable web elements, with options to submit or type slowly, using structured accessibility snapshots for precise interaction.

Instructions

Type text into editable element

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
elementYesHuman-readable element description used to obtain permission to interact with the element
refYesExact target element reference from the page snapshot
slowlyNoWhether to type one character at a time. Useful for triggering key handlers in the page. By default entire text is filled in at once.
submitNoWhether to submit entered text (press Enter after)
textYesText to type into the element

Implementation Reference

  • The handler function that executes the browser_type tool: types text into a locator-resolved element, with options for slow typing (pressSequentially) or fast fill, and optional Enter press for submit.
    handle: async (tab, params, response) => { const locator = await tab.refLocator(params); await tab.waitForCompletion(async () => { if (params.slowly) { response.setIncludeSnapshot(); response.addCode(`// Press "${params.text}" sequentially into "${params.element}"`); response.addCode(`await page.${await generateLocator(locator)}.pressSequentially(${javascript.quote(params.text)});`); await locator.pressSequentially(params.text); } else { response.addCode(`// Fill "${params.text}" into "${params.element}"`); response.addCode(`await page.${await generateLocator(locator)}.fill(${javascript.quote(params.text)});`); await locator.fill(params.text); } if (params.submit) { response.setIncludeSnapshot(); response.addCode(`await page.${await generateLocator(locator)}.press('Enter');`); await locator.press('Enter'); } }); },
  • Type schema (lines 48-52) and tool schema (56-62) defining inputs for browser_type: element locator, text to type, optional submit and slowly flags.
    const typeSchema = elementSchema.extend({ text: z.string().describe('Text to type into the element'), submit: z.boolean().optional().describe('Whether to submit entered text (press Enter after)'), slowly: z.boolean().optional().describe('Whether to type one character at a time. Useful for triggering key handlers in the page. By default entire text is filled in at once.'), }); const type = defineTabTool({ capability: 'core', schema: { name: 'browser_type', title: 'Type text', description: 'Type text into editable element', inputSchema: typeSchema, type: 'destructive', },
  • src/tools.ts:36-52 (registration)
    Includes keyboard tools (containing browser_type) via spread operator at line 43 into the allTools array exported for use in the tool system.
    export const allTools: Tool<any>[] = [ ...common, ...console, ...dialogs, ...evaluate, ...files, ...install, ...keyboard, ...navigate, ...network, ...mouse, ...pdf, ...screenshot, ...snapshot, ...tabs, ...wait, ];
  • src/tools.ts:23-23 (registration)
    Imports the keyboard module which exports the browser_type tool implementation.
    import keyboard from './tools/keyboard.js';

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/nzjami/mcpPlaywright'

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