Skip to main content
Glama
jomon003

PlayMCP Browser Automation Server

by jomon003

type

Enter text into web page elements using CSS selectors to automate form filling, search queries, and data entry tasks in browser automation workflows.

Instructions

Type text into an element

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYes
textYes

Implementation Reference

  • Core implementation of the 'type' tool: types text into the specified selector using Playwright's page.type() method.
    async type(selector: string, text: string): Promise<void> { try { if (!this.isInitialized()) { throw new Error('Browser not initialized'); } this.log('Typing into element', { selector, text }); await this.state.page?.type(selector, text); this.log('Type complete'); } catch (error: any) { console.error('Type error:', error); throw new BrowserError('Failed to type text', 'Check if the input element exists and is editable'); } }
  • Input schema definition for the 'type' tool, specifying selector and text parameters.
    const TYPE_TOOL: Tool = { name: "type", description: "Type text into an element", inputSchema: { type: "object", properties: { selector: { type: "string" }, text: { type: "string" } }, required: ["selector", "text"] } };
  • src/server.ts:517-517 (registration)
    Registration of the 'type' tool in the tools dictionary used by the MCP server.
    type: TYPE_TOOL,
  • Dispatch handler in callTool request handler that validates input and delegates to playwrightController.type.
    case 'type': { if (!args.selector || !args.text) { return { content: [{ type: "text", text: "Selector and text are required" }], isError: true }; } await playwrightController.type(args.selector as string, args.text as string); return { content: [{ type: "text", text: "Text entered successfully" }] }; }

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/jomon003/PlayMCP'

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