Skip to main content
Glama
Radek44

MCP Tauri Automation

by Radek44

get_element_text

Extract text content from UI elements in Tauri desktop applications using CSS selectors for automation and testing workflows.

Instructions

Get the text content of an element

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector to identify the element

Implementation Reference

  • The handler function that executes the get_element_text tool logic. It calls the TauriDriver's getElementText method and wraps the result in a ToolResponse.
    export async function getElementText(
      driver: TauriDriver,
      params: ElementSelector
    ): Promise<ToolResponse<{ text: string }>> {
      try {
        const text = await driver.getElementText(params.selector);
    
        return {
          success: true,
          data: {
            text,
          },
        };
      } catch (error) {
        return {
          success: false,
          error: error instanceof Error ? error.message : String(error),
        };
      }
    }
  • The input schema definition for the get_element_text tool, registered in the ListTools handler.
    {
      name: 'get_element_text',
      description: 'Get the text content of an element',
      inputSchema: {
        type: 'object',
        properties: {
          selector: {
            type: 'string',
            description: 'CSS selector to identify the element',
          },
        },
        required: ['selector'],
      },
    },
  • src/index.ts:298-307 (registration)
    The registration/dispatch case in the CallToolRequestSchema handler that invokes the getElementText function.
    case 'get_element_text': {
      const result = await getElementText(driver, args as any);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
  • The underlying TauriDriver method that performs the actual element text retrieval using WebDriverIO.
    async getElementText(selector: string): Promise<string> {
      this.ensureAppRunning();
    
      const element = await this.appState.browser!.$(selector);
      if (!(await element.isExisting())) {
        throw new Error(`Element not found: ${selector}`);
      }
    
      return await element.getText();
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Get' implies a read operation, it doesn't specify whether this tool requires the element to be visible/loaded, what happens if the selector matches multiple elements, error behavior for non-existent elements, or performance characteristics. The description adds minimal behavioral context beyond the basic operation.

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 a single, efficient sentence that directly states the tool's purpose without any unnecessary words. It's perfectly front-loaded with the core functionality immediately apparent. Every word earns its place in this minimal description.

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

Completeness3/5

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

For a single-parameter read operation with no output schema, the description provides the basic purpose but lacks important context. It doesn't explain what format the text is returned in (plain text, HTML, trimmed), whether whitespace is normalized, or what happens with nested elements. The description is minimally adequate but leaves significant gaps in understanding the tool's behavior.

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?

Schema description coverage is 100% with the selector parameter fully documented in the schema. The description doesn't add any parameter-specific information beyond what's already in the schema. This meets the baseline score of 3 when schema coverage is high and no additional parameter semantics are provided.

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 verb 'Get' and the resource 'text content of an element', making the purpose immediately understandable. However, it doesn't distinguish this tool from potential siblings like 'get_app_state' or 'wait_for_element' that might also retrieve text-related information in different contexts.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'capture_screenshot' (visual capture) and 'wait_for_element' (timing-based), there's no indication whether this tool should be used for immediate text extraction versus waiting for elements to appear or capturing text via screenshots.

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