Skip to main content
Glama

type

Simulate user text input into web elements using CSS selectors for automated browser testing and interaction validation.

Instructions

Type text into an input field identified by a CSS selector

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector of the input field
textYesText to type

Implementation Reference

  • Core implementation of the 'type' tool handler using Puppeteer to wait for and type text into a CSS selector.
    async type(selector: string, text: string) { const page = await this.init(); try { await page.waitForSelector(selector, { timeout: 5000 }); await page.type(selector, text); return `Typed "${text}" into ${selector}`; } catch (e: any) { throw new Error(`Failed to type into ${selector}: ${e.message}`); } }
  • Dispatch handler in the MCP call tool request that invokes the browserManager.type method.
    case "type": result = await browserManager.type(String(args?.selector), String(args?.text)); break;
  • Input schema definition for the 'type' tool, specifying selector and text parameters.
    inputSchema: { type: "object", properties: { selector: { type: "string", description: "CSS selector of the input field" }, text: { type: "string", description: "Text to type" }, }, required: ["selector", "text"], },
  • src/index.ts:48-59 (registration)
    Registration of the 'type' tool in the TOOLS array used for listing available tools.
    { name: "type", description: "Type text into an input field identified by a CSS selector", inputSchema: { type: "object", properties: { selector: { type: "string", description: "CSS selector of the input field" }, text: { type: "string", description: "Text to type" }, }, required: ["selector", "text"], }, },

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/samusilv/qa-agent-mcp'

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