fill
Enter text into form fields using CSS selectors or element references to automate desktop application testing and interaction.
Instructions
Fill input by ref or selector
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | No | Ref from snapshot | |
| selector | No | CSS selector | |
| value | Yes | Value | |
| window | No | Window label (default: focused window) |
Implementation Reference
- The main tool handler for the 'fill' command that validates input (requires ref or selector) and delegates to socketManager.fill()fill: async (args: { ref?: number; selector?: string; value: string; window?: string }) => { if (!args.ref && !args.selector) { throw new Error('Either ref or selector must be provided'); } const result = await socketManager.fill(args); return { content: [ { type: 'text' as const, text: result, }, ], }; },
- Tool schema definition using Zod validation defining the fill tool's name, description, and input parameters (ref, selector, value, window)fill: { name: 'fill', description: 'Fill input by ref or selector', inputSchema: z.object({ ref: z.number().optional().describe('Ref from snapshot'), selector: z.string().optional().describe('CSS selector'), value: z.string().describe('Value'), window: z.string().optional().describe('Window label (default: focused window)'), }), },
- The SocketManager.fill method that sends the 'fill' command to the Tauri app via JSON-RPC socket communication and returns a formatted result messageasync fill(options: { ref?: number; selector?: string; value: string; window?: string }): Promise<string> { const result = await this.sendCommand('fill', options) as { success: boolean; error?: string }; if (!result.success) { throw new Error(result.error || 'Fill failed'); } const target = options.ref ? `ref=${options.ref}` : options.selector; const windowInfo = options.window ? ` in window '${options.window}'` : ''; return `Filled ${target} with "${options.value}"${windowInfo}`; }
- packages/tauri-mcp/src/server.ts:14-23 (registration)The 'fill' tool is registered in the DEFAULT_ESSENTIAL_TOOLS array, making it one of the core tools always available in the MCP serverconst DEFAULT_ESSENTIAL_TOOLS = [ 'app_status', 'launch_app', 'stop_app', 'snapshot', 'click', 'fill', 'screenshot', 'navigate', ];