Skip to main content
Glama

detox_validate_config

Validate Detox configuration files to identify errors and warnings before running mobile tests.

Instructions

Validate Detox configuration for errors and warnings.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathNoPath to project root
configurationNoSpecific configuration to validate

Implementation Reference

  • Main handler implementation for the 'detox_validate_config' tool. Reads the Detox config and validates it using the imported validateConfig helper.
    export const validateConfigTool: Tool = {
      name: "detox_validate_config",
      description: "Validate Detox configuration for errors and warnings.",
      inputSchema: zodToJsonSchema(ValidateConfigArgsSchema),
      handler: async (args: z.infer<typeof ValidateConfigArgsSchema>) => {
        const parsed = ValidateConfigArgsSchema.parse(args);
        const projectPath = parsed.projectPath || process.cwd();
    
        const result = await readDetoxConfig(projectPath);
    
        if (!result) {
          return {
            success: false,
            valid: false,
            errors: ["No Detox configuration found."],
            warnings: [],
          };
        }
    
        const validation = validateConfig(result.config);
    
        return {
          success: true,
          ...validation,
        };
      },
    };
  • Zod input schema for the detox_validate_config tool arguments.
    export const ValidateConfigArgsSchema = z.object({
      projectPath: z.string().optional().describe("Path to project root"),
      configuration: z.string().optional().describe("Specific configuration to validate"),
    });
    
    export type ValidateConfigArgs = z.infer<typeof ValidateConfigArgsSchema>;
  • Core validation logic function that checks Detox config for errors and warnings, used by the tool handler.
    export function validateConfig(config: DetoxConfig): {
      valid: boolean;
      errors: string[];
      warnings: string[];
    } {
      const errors: string[] = [];
      const warnings: string[] = [];
    
      // Check for required sections
      if (!config.configurations || Object.keys(config.configurations).length === 0) {
        errors.push("No configurations defined");
      }
    
      if (!config.devices || Object.keys(config.devices).length === 0) {
        errors.push("No devices defined");
      }
    
      if (!config.apps || Object.keys(config.apps).length === 0) {
        errors.push("No apps defined");
      }
    
      // Validate each configuration
      if (config.configurations) {
        for (const [name, conf] of Object.entries(config.configurations)) {
          if (!config.devices?.[conf.device]) {
            errors.push(`Configuration "${name}" references undefined device "${conf.device}"`);
          }
          if (!config.apps?.[conf.app]) {
            errors.push(`Configuration "${name}" references undefined app "${conf.app}"`);
          }
        }
      }
    
      // Validate apps have build commands
      if (config.apps) {
        for (const [name, app] of Object.entries(config.apps)) {
          if (!app.binaryPath) {
            errors.push(`App "${name}" is missing binaryPath`);
          }
          if (!app.build) {
            warnings.push(`App "${name}" has no build command defined`);
          }
        }
      }
    
      // Validate device types
      const validDeviceTypes = [
        "ios.simulator",
        "ios.device",
        "android.emulator",
        "android.attached",
        "android.genycloud",
      ];
    
      if (config.devices) {
        for (const [name, device] of Object.entries(config.devices)) {
          if (!validDeviceTypes.includes(device.type)) {
            warnings.push(`Device "${name}" has unknown type "${device.type}"`);
          }
        }
      }
    
      return {
        valid: errors.length === 0,
        errors,
        warnings,
      };
    }
  • The tool is registered in the allTools export array, likely used for MCP tool registration.
    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?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool validates for 'errors and warnings,' which implies a read-only diagnostic operation, but doesn't specify if it modifies anything, requires specific permissions, or has side effects like logging. For a validation tool with zero annotation coverage, this leaves critical behavioral traits unclear, though it's not misleading.

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: 'Validate Detox configuration for errors and warnings.' It is front-loaded with the core action and resource, with no wasted words. Every part of the sentence contributes directly to understanding the tool's purpose, making it highly concise and well-structured.

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?

Given the tool's complexity is moderate (validation with 2 parameters), no annotations, and no output schema, the description is minimally adequate. It covers the basic purpose but lacks details on behavior, usage context, or output format. For a diagnostic tool, more information on what the validation returns (e.g., error messages, success status) would improve completeness, but it meets the minimum viable threshold.

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 parameter descriptions: 'projectPath' as 'Path to project root' and 'configuration' as 'Specific configuration to validate.' The description adds no additional meaning beyond this, such as explaining parameter interactions or default behaviors. With high schema coverage, the baseline score of 3 is appropriate, as the schema handles 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: 'Validate Detox configuration for errors and warnings.' It specifies the verb ('validate') and resource ('Detox configuration'), making the action explicit. However, it doesn't differentiate this validation tool from its sibling 'detox_read_config' or 'detox_list_configurations', which might also involve configuration inspection, so it misses full 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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, such as needing an existing configuration, or specify scenarios like pre-test validation. With siblings like 'detox_read_config' and 'detox_list_configurations', there's no indication of when validation is preferred over reading or listing, leaving usage ambiguous.

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