Skip to main content
Glama
Radek44
by Radek44

type_text

Automate text input into desktop application fields using CSS selectors to specify target elements and define text content for testing workflows.

Instructions

Type text into an input field or editable element

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector to identify the input element
textYesText to type into the element
clearNoWhether to clear existing text before typing. Default: false

Implementation Reference

  • Main handler function for the 'type_text' tool. Calls the driver's typeText method and wraps the result in a ToolResponse.
    export async function typeText( driver: TauriDriver, params: TypeTextParams ): Promise<ToolResponse<{ message: string }>> { try { await driver.typeText(params.selector, params.text, params.clear); return { success: true, data: { message: `Typed text into element: ${params.selector}`, }, }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error), }; } }
  • TypeScript interface defining the input parameters for the type_text tool.
    export interface TypeTextParams { /** CSS selector for the input element */ selector: string; /** Text to type */ text: string; /** Whether to clear existing text first */ clear?: boolean; }
  • src/index.ts:116-138 (registration)
    Tool registration in the MCP server, including name 'type_text' and input schema matching TypeTextParams.
    { name: 'type_text', description: 'Type text into an input field or editable element', inputSchema: { type: 'object', properties: { selector: { type: 'string', description: 'CSS selector to identify the input element', }, text: { type: 'string', description: 'Text to type into the element', }, clear: { type: 'boolean', description: 'Whether to clear existing text before typing. Default: false', default: false, }, }, required: ['selector', 'text'], }, },
  • src/index.ts:274-284 (registration)
    Dispatch handler in the CallToolRequestSchema switch statement that invokes the typeText handler.
    case 'type_text': { const result = await typeText(driver, args as any); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
  • Low-level implementation in TauriDriver class that performs the actual element selection, clearing, and value setting using WebDriverIO.
    async typeText(selector: string, text: string, clear: boolean = false): Promise<void> { this.ensureAppRunning(); const element = await this.appState.browser!.$(selector); if (!(await element.isExisting())) { throw new Error(`Element not found: ${selector}`); } if (clear) { await element.clearValue(); } await element.setValue(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/Radek44/mcp-tauri-automation'

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