Skip to main content
Glama
andreahaku

Expo iOS Development MCP Server

by andreahaku

ui.assert_text

Verify UI elements display expected text content in iOS Simulator during React Native/Expo testing. Specify element selector and text to validate exact or partial matches.

Instructions

Assert that an element has specific text content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesElement selector.
textYesExpected text content.
exactNoExact match (true) or contains (false).

Implementation Reference

  • Registration and inline handler implementation for the 'ui.assert_text' tool. Generates a Detox snippet for text assertion and executes it via runDetoxAction, returning the result.
    server.tool(
      "ui.assert_text",
      "Assert that an element has specific text content",
      UiAssertTextInputSchema.shape,
      async (args) => {
        try {
          const snippet = generateAssertTextSnippet({
            selector: args.selector,
            text: args.text,
            exact: args.exact,
          });
          const result = await runDetoxAction({
            actionName: `assertText:${describeSelector(args.selector)}`,
            actionSnippet: snippet,
          });
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(result, null, 2),
              },
            ],
            isError: !result.success,
          };
        } catch (error) {
          return handleToolError(error);
        }
      }
    );
  • Zod input schema defining parameters for the ui.assert_text tool: selector, text, and optional exact match flag.
    export const UiAssertTextInputSchema = z.object({
      selector: SelectorSchema.describe("Element selector."),
      text: z.string().describe("Expected text content."),
      exact: z.boolean().optional().default(true).describe("Exact match (true) or contains (false)."),
    });
  • Helper function that generates the Detox code snippet for asserting text content on a UI element, supporting exact or partial matches.
    export function generateAssertTextSnippet(options: AssertTextOptions): string {
      const el = buildElementExpr(options.selector);
      const escapedText = JSON.stringify(options.text);
    
      if (options.exact !== false) {
        return `await expect(${el}).toHaveText(${escapedText});`;
      }
      // For partial text match, we use toHaveText with regex
      return `await expect(${el}).toHaveText(new RegExp(${escapedText}));`;
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions 'assert' which implies a verification/validation behavior, but doesn't disclose what happens on failure (does it throw an error? return boolean?), timeout behavior, or whether it modifies UI state. For a verification tool with zero annotation coverage, this is insufficient behavioral disclosure.

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?

Perfectly concise single sentence that states the core functionality. No wasted words, front-loaded with the main purpose. 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.

Completeness2/5

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

For a UI testing assertion tool with no annotations and no output schema, the description is incomplete. It doesn't explain what 'assert' means operationally (pass/fail behavior), doesn't mention typical testing contexts, and provides no guidance on selector strategies despite the complex nested selector parameter. Should do more given the testing domain complexity.

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%, so the schema already documents all parameters thoroughly. The description doesn't add any parameter semantics beyond what's in the schema - it doesn't explain selector strategies, text matching nuances, or provide examples. Baseline 3 is appropriate when 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 tool's purpose: 'Assert that an element has specific text content'. It uses a specific verb ('assert') and resource ('element'), but doesn't differentiate from siblings like ui.wait_for (which might also involve text verification). The purpose is unambiguous but lacks sibling distinction.

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?

No guidance on when to use this tool versus alternatives like ui.wait_for or ui.tap. The description doesn't mention prerequisites, error conditions, or typical testing scenarios. It provides no context about when this assertion should be preferred over other UI interaction tools.

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/andreahaku/expo_ios_development_mcp'

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