Skip to main content
Glama
Radek44

MCP Tauri Automation

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),
          },
        ],
      };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions waiting for appearance and handling async UI states, but doesn't specify what happens on timeout (e.g., throws error, returns null), whether it polls continuously or uses event listeners, or any performance implications. This leaves significant behavioral gaps for an agent to understand how to use it effectively.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with two short sentences that are front-loaded and waste no words. Every part earns its place by stating the core purpose and a key usage context without redundancy or fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a DOM waiting tool with no annotations and no output schema, the description is incomplete. It doesn't explain return values (e.g., returns element, boolean, or throws), error conditions, or detailed behavioral traits like polling frequency. For a tool that interacts with async UI states, more context is needed for reliable agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with clear documentation for both parameters (selector and timeout). The description adds no additional parameter semantics beyond what's in the schema, such as selector syntax examples or timeout behavior details. With high schema coverage, the baseline score of 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('wait for an element to appear') and the target ('in the DOM'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'get_element_text' or 'click_element' which also involve DOM elements, though the 'wait for appearance' aspect provides some implicit distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage guidance with 'useful for handling async UI states,' suggesting when this tool might be appropriate. However, it doesn't explicitly state when to use this versus alternatives like 'get_element_text' (which might also wait implicitly) or provide clear exclusions or prerequisites for usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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