type_text
Automate entering text into web input fields using CSS selectors, with configurable keystroke delay for precise browser form filling.
Instructions
Type text into an input field
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | CSS selector for the input element | |
| text | Yes | Text to type | |
| delay | No | Delay between keystrokes in milliseconds |
Implementation Reference
- src/index.ts:33-37 (schema)Zod schema for 'type_text' tool input validation: selector (string), text (string), delay (number, default 100)
const TypeTextSchema = z.object({ selector: z.string(), text: z.string(), delay: z.number().default(100) }); - src/index.ts:196-218 (registration)Registration of the 'type_text' tool in the ListToolsRequestSchema handler, providing name, description, and inputSchema
{ name: 'type_text', description: 'Type text into an input field', inputSchema: { type: 'object', properties: { selector: { type: 'string', description: 'CSS selector for the input element' }, text: { type: 'string', description: 'Text to type' }, delay: { type: 'number', default: 100, description: 'Delay between keystrokes in milliseconds' } }, required: ['selector', 'text'] } }, - src/index.ts:501-517 (handler)Handler logic for 'type_text' tool: validates args using TypeTextSchema, calls currentPage.fill(selector, text) to type text into the specified input element
case 'type_text': { if (!currentPage) { throw new Error('No browser page available. Launch a browser first.'); } const params = TypeTextSchema.parse(args); await currentPage.fill(params.selector, params.text); return { content: [ { type: 'text', text: `Typed "${params.text}" into element: ${params.selector}` } ] }; }