Skip to main content
Glama

detox_test

Execute end-to-end mobile tests for React Native applications with configurable options for device setup, retries, and artifact collection.

Instructions

Run Detox E2E tests with full options for configuration, retries, artifacts, and more.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
configurationNoDevice configuration name
testFilePathsNoSpecific test files to run
testNamePatternNoRegex pattern to filter tests
deviceNameNoOverride device name
loglevelNoinfo
retriesNoNumber of times to retry failing tests
reuseNoReuse existing app installation
headlessNoRun in headless mode
recordLogsNofailing
takeScreenshotsNofailing
recordVideosNonone
artifactsLocationNoCustom path for artifacts
cleanupNoShutdown simulator after tests
cwdNoWorking directory

Implementation Reference

  • The complete tool definition for 'detox_test', including name, description, input schema reference, and the handler function that constructs and executes the 'detox test' CLI command with all supported options, parses results, and returns structured output including test summary and artifacts info.
    export const testTool: Tool = {
      name: "detox_test",
      description: "Run Detox E2E tests with full options for configuration, retries, artifacts, and more.",
      inputSchema: zodToJsonSchema(TestArgsSchema),
      handler: async (args: z.infer<typeof TestArgsSchema>) => {
        const parsed = TestArgsSchema.parse(args);
        const cliArgs: string[] = ["test"];
    
        if (parsed.configuration) {
          cliArgs.push("-c", parsed.configuration);
        }
        if (parsed.loglevel) {
          cliArgs.push("-l", parsed.loglevel);
        }
        if (parsed.retries !== undefined) {
          cliArgs.push("--retries", String(parsed.retries));
        }
        if (parsed.reuse) {
          cliArgs.push("--reuse");
        }
        if (parsed.headless) {
          cliArgs.push("--headless");
        }
        if (parsed.recordLogs) {
          cliArgs.push("--record-logs", parsed.recordLogs);
        }
        if (parsed.takeScreenshots) {
          cliArgs.push("--take-screenshots", parsed.takeScreenshots);
        }
        if (parsed.recordVideos) {
          cliArgs.push("--record-videos", parsed.recordVideos);
        }
        if (parsed.artifactsLocation) {
          cliArgs.push("--artifacts-location", parsed.artifactsLocation);
        }
        if (parsed.cleanup) {
          cliArgs.push("--cleanup");
        }
        if (parsed.deviceName) {
          cliArgs.push("--device-name", parsed.deviceName);
        }
        if (parsed.testNamePattern) {
          cliArgs.push("--testNamePattern", parsed.testNamePattern);
        }
    
        // Add test file paths at the end
        if (parsed.testFilePaths && parsed.testFilePaths.length > 0) {
          cliArgs.push("--", ...parsed.testFilePaths);
        }
    
        const result = await executeDetoxCommand(cliArgs, {
          cwd: parsed.cwd,
          timeout: 600000, // 10 minutes for tests
        });
    
        // Parse test results from output
        const passMatch = result.stdout.match(/(\d+) passed/);
        const failMatch = result.stdout.match(/(\d+) failed/);
        const skipMatch = result.stdout.match(/(\d+) skipped/);
    
        return {
          success: result.success,
          summary: {
            passed: passMatch ? parseInt(passMatch[1]) : 0,
            failed: failMatch ? parseInt(failMatch[1]) : 0,
            skipped: skipMatch ? parseInt(skipMatch[1]) : 0,
          },
          output: result.stdout,
          errors: result.stderr,
          duration: `${(result.duration / 1000).toFixed(1)}s`,
          artifactsLocation: parsed.artifactsLocation || "./artifacts",
        };
      },
    };
  • Zod schema (TestArgsSchema) defining all input parameters for the detox_test tool, with descriptions, defaults, and types for validation and MCP inputSchema generation.
    // Test tool schema
    export const TestArgsSchema = z.object({
      configuration: z.string().optional().describe("Device configuration name"),
      testFilePaths: z.array(z.string()).optional().describe("Specific test files to run"),
      testNamePattern: z.string().optional().describe("Regex pattern to filter tests"),
      deviceName: z.string().optional().describe("Override device name"),
      loglevel: z
        .enum(["fatal", "error", "warn", "info", "verbose", "trace"])
        .optional()
        .default("info"),
      retries: z.number().optional().describe("Number of times to retry failing tests"),
      reuse: z.boolean().optional().describe("Reuse existing app installation"),
      headless: z.boolean().optional().describe("Run in headless mode"),
      recordLogs: z.enum(["failing", "all", "none"]).optional().default("failing"),
      takeScreenshots: z.enum(["manual", "failing", "all", "none"]).optional().default("failing"),
      recordVideos: z.enum(["failing", "all", "none"]).optional().default("none"),
      artifactsLocation: z.string().optional().describe("Custom path for artifacts"),
      cleanup: z.boolean().optional().describe("Shutdown simulator after tests"),
      cwd: z.string().optional().describe("Working directory"),
    });
    
    export type TestArgs = z.infer<typeof TestArgsSchema>;
  • src/index.ts:40-48 (registration)
    MCP server ListTools request handler that registers and exposes the detox_test tool (via allTools) with its name, description, and schema to MCP clients.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: allTools.map((tool) => ({
          name: tool.name,
          description: tool.description,
          inputSchema: tool.inputSchema,
        })),
      };
    });
  • src/index.ts:50-94 (registration)
    MCP server CallTool request handler that dispatches calls to the detox_test handler by looking up the tool by name in allTools and executing it with arguments.
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
    
      const tool = allTools.find((t) => t.name === name);
      if (!tool) {
        throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
      }
    
      try {
        // Add project path to args if not specified
        const argsWithPath = {
          ...args,
          cwd: (args as any)?.cwd || PROJECT_PATH,
          projectPath: (args as any)?.projectPath || PROJECT_PATH,
        };
    
        const result = await tool.handler(argsWithPath);
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                {
                  success: false,
                  error: error.message,
                },
                null,
                2
              ),
            },
          ],
          isError: true,
        };
      }
    });
  • Central registry of all tools including detox_test (as testTool), exported for use in MCP server.
    export const allTools: Tool[] = [
      buildTool,
      testTool,
      initTool,
      readConfigTool,
      listConfigurationsTool,
      validateConfigTool,
      createConfigTool,
      listDevicesTool,
      generateTestTool,
      generateMatcherTool,
      generateActionTool,
      generateExpectationTool,
    ];
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'full options' but doesn't explain critical behaviors: whether this is a read-only or destructive operation, what happens during test execution (e.g., app installation, simulator startup), error handling, or output format. For a complex 14-parameter tool with no annotations, this leaves significant gaps in understanding how the tool behaves.

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

Conciseness4/5

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

The description is a single, efficient sentence that front-loads the core purpose. Every word contributes to understanding the tool's scope. While it could be slightly more structured (e.g., separating purpose from capabilities), it avoids redundancy and stays focused on essential information.

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 complex 14-parameter testing tool with no annotations and no output schema, the description is inadequate. It doesn't explain what 'running tests' entails behaviorally, what outputs or results to expect, error conditions, or dependencies on other tools. Given the richness needed for a test execution tool, this leaves too many contextual gaps for effective 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 description mentions 'configuration, retries, artifacts, and more' which loosely maps to some parameters (configuration, retries, artifactsLocation), but doesn't add meaningful semantics beyond what the 71% schema coverage already provides. With moderate schema coverage, the baseline is 3 - the description doesn't compensate for the 29% undocumented parameters nor provide deeper context about parameter interactions or constraints.

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 ('Run Detox E2E tests') and scope ('with full options for configuration, retries, artifacts, and more'), making the purpose immediately understandable. It distinguishes this tool from siblings like detox_build or detox_init by focusing on test execution rather than setup or configuration tasks. However, it doesn't explicitly differentiate from all siblings (e.g., detox_generate_test might be related).

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. It doesn't mention prerequisites (e.g., needing a built app or configuration), when to choose this over other testing approaches, or which sibling tools should be used first (like detox_build or detox_create_config). The agent must infer usage from the tool name and sibling context alone.

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/gayancliyanage/detox-mcp'

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