Skip to main content
Glama
Radek44
by Radek44

wait_for_element

Wait for a UI element to appear in the DOM before proceeding, handling asynchronous page loading and dynamic content updates in Tauri desktop applications.

Instructions

Wait for an element to appear in the DOM. Useful for handling async UI states.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector to wait for
timeoutNoTimeout in milliseconds. Default: 5000

Implementation Reference

  • The core handler function that executes the 'wait_for_element' tool logic. It calls the underlying TauriDriver's waitForElement method with the provided selector and optional timeout, then wraps the result in a standardized ToolResponse.
    export async function waitForElement( driver: TauriDriver, params: WaitForElementParams ): Promise<ToolResponse<{ message: string }>> { try { await driver.waitForElement(params.selector, params.timeout); return { success: true, data: { message: `Element found: ${params.selector}`, }, }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error), }; } }
  • src/index.ts:139-157 (registration)
    The tool registration in the ListTools response, defining the name, description, and input schema for 'wait_for_element'.
    { name: 'wait_for_element', description: 'Wait for an element to appear in the DOM. Useful for handling async UI states.', inputSchema: { type: 'object', properties: { selector: { type: 'string', description: 'CSS selector to wait for', }, timeout: { type: 'number', description: 'Timeout in milliseconds. Default: 5000', default: 5000, }, }, required: ['selector'], }, },
  • TypeScript interface defining the parameters for the wait_for_element tool, used by the handler function.
    export interface WaitForElementParams { /** CSS selector to wait for */ selector: string; /** Timeout in milliseconds */ timeout?: number; }
  • The dispatcher case in the CallToolRequest handler that invokes the waitForElement tool function and formats the MCP response.
    case 'wait_for_element': { const result = await waitForElement(driver, args as any); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }

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