Type
pinchtab_typeType text into input fields by element reference ID. Uses human-like keystroke simulation; optionally clear field first for React/Vue/Angular inputs.
Instructions
Type text into an input field by its ref ID. Uses human-like typing by default. Set clearFirst=true to click, select all, then type — required for React/Vue/Angular inputs where direct fill doesn't trigger state updates.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clearFirst | No | Click the field, select all (Ctrl+A), then type. Required for React/Vue/Angular inputs. | |
| fast | No | Speed up humanType with shorter delays between keystrokes. Only applies when humanType=true. | |
| humanType | No | Use human-like keystroke simulation (default: true). Set to false for fast programmatic fill. | |
| ref | Yes | Element reference ID of the input field | |
| text | Yes | Text to type into the field |
Implementation Reference
- src/tools/interaction.ts:51-96 (registration)Registration of the 'pinchtab_type' tool on the MCP server, including its schema and handler.
server.registerTool( "pinchtab_type", { description: "Type text into an input field by its ref ID. Uses human-like typing by default. Set clearFirst=true to click, select all, then type — required for React/Vue/Angular inputs where direct fill doesn't trigger state updates.", inputSchema: z.object({ clearFirst: z .boolean() .optional() .describe( "Click the field, select all (Ctrl+A), then type. Required for React/Vue/Angular inputs.", ), fast: z .boolean() .optional() .describe( "Speed up humanType with shorter delays between keystrokes. Only applies when humanType=true.", ), humanType: z .boolean() .optional() .describe( "Use human-like keystroke simulation (default: true). Set to false for fast programmatic fill.", ), ref: z.string().describe("Element reference ID of the input field"), text: z.string().describe("Text to type into the field"), }), title: "Type", }, async ({ ref, text, humanType, fast, clearFirst }) => { try { if (clearFirst) { await pinch("POST", "/action", { kind: "click", ref }); await pinch("POST", "/action", { key: "Control+a", kind: "press", ref }); await pinch("POST", "/action", { kind: "type", ref, text }); return toolResult({ cleared: true, ref, typed: text }); } const kind = humanType === false ? "fill" : "humanType"; const body: Record<string, unknown> = { kind, ref, text }; if (fast && kind === "humanType") body.fast = true; return toolResult(await pinch("POST", "/action", body)); } catch (error) { return toolError(error); } }, ); - src/tools/interaction.ts:56-77 (schema)Input schema (Zod) for the pinchtab_type tool, defining ref, text, humanType, fast, and clearFirst parameters.
inputSchema: z.object({ clearFirst: z .boolean() .optional() .describe( "Click the field, select all (Ctrl+A), then type. Required for React/Vue/Angular inputs.", ), fast: z .boolean() .optional() .describe( "Speed up humanType with shorter delays between keystrokes. Only applies when humanType=true.", ), humanType: z .boolean() .optional() .describe( "Use human-like keystroke simulation (default: true). Set to false for fast programmatic fill.", ), ref: z.string().describe("Element reference ID of the input field"), text: z.string().describe("Text to type into the field"), }), - src/tools/interaction.ts:80-95 (handler)Handler function for pinchtab_type: dispatches /action HTTP calls to the PinchTab backend with kind 'humanType' (default), 'fill', or a clearFirst sequence (click, Ctrl+A, type).
async ({ ref, text, humanType, fast, clearFirst }) => { try { if (clearFirst) { await pinch("POST", "/action", { kind: "click", ref }); await pinch("POST", "/action", { key: "Control+a", kind: "press", ref }); await pinch("POST", "/action", { kind: "type", ref, text }); return toolResult({ cleared: true, ref, typed: text }); } const kind = humanType === false ? "fill" : "humanType"; const body: Record<string, unknown> = { kind, ref, text }; if (fast && kind === "humanType") body.fast = true; return toolResult(await pinch("POST", "/action", body)); } catch (error) { return toolError(error); } }, - src/pinchtab/client.ts:6-11 (helper)The 'pinch' helper function used by the handler to make HTTP requests to the PinchTab backend (POST /action).
export async function pinch( method: string, path: string, body?: Record<string, unknown>, ): Promise<unknown> { if (!(await isPinchtabRunning())) { - src/utils.ts:11-18 (helper)Helper functions toolResult and toolError used by the handler to format MCP responses.
interface ToolResult { [key: string]: unknown; content: { text: string; type: "text" }[]; isError?: boolean; } /** Wrap a tool handler with standardized error handling. */ export function toolResult(data: unknown): ToolResult {