Skip to main content
Glama

detox_read_config

Read and parse the Detox mobile testing configuration file to access test settings and parameters for React Native E2E testing.

Instructions

Read and parse the current Detox configuration file (.detoxrc.js or similar).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathNoPath to project root
configPathNoExplicit path to config file

Implementation Reference

  • The primary handler implementation for the 'detox_read_config' tool, which parses input arguments and calls readDetoxConfig to retrieve and return the Detox configuration.
    export const readConfigTool: Tool = {
      name: "detox_read_config",
      description: "Read and parse the current Detox configuration file (.detoxrc.js or similar).",
      inputSchema: zodToJsonSchema(ReadConfigArgsSchema),
      handler: async (args: z.infer<typeof ReadConfigArgsSchema>) => {
        const parsed = ReadConfigArgsSchema.parse(args);
        const projectPath = parsed.projectPath || process.cwd();
    
        const result = await readDetoxConfig(projectPath);
    
        if (!result) {
          return {
            success: false,
            error: "No Detox configuration found. Run 'detox init' to create one.",
          };
        }
    
        return {
          success: true,
          configPath: result.configPath,
          config: result.config,
        };
      },
    };
  • Zod schema defining the input parameters for the detox_read_config tool, used for validation and JSON schema generation.
    export const ReadConfigArgsSchema = z.object({
      projectPath: z.string().optional().describe("Path to project root"),
      configPath: z.string().optional().describe("Explicit path to config file"),
    });
    
    export type ReadConfigArgs = z.infer<typeof ReadConfigArgsSchema>;
  • Core helper function that locates the Detox config file, parses it, and returns the configuration object or null if not found.
    export async function readDetoxConfig(projectPath: string): Promise<{
      config: DetoxConfig;
      configPath: string;
    } | null> {
      const configPath = await findConfigFile(projectPath);
      if (!configPath) {
        return null;
      }
    
      try {
        const config = await parseConfig(configPath);
        return { config, configPath };
      } catch (error) {
        throw new Error(`Failed to parse Detox config at ${configPath}: ${error}`);
      }
    }
  • Registration of all MCP tools including 'detox_read_config' (as readConfigTool) in the allTools export array.
    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 full burden. It states the tool reads and parses a config file, implying a read-only operation, but doesn't disclose behavioral traits such as error handling (e.g., if file is missing), permissions needed, or output format. This leaves gaps for a tool with no annotation coverage.

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?

Single sentence, front-loaded with the core action, zero waste. Every word earns its place by specifying the verb, resource, and file types efficiently.

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 no annotations and no output schema, the description is incomplete. It doesn't explain what the parsed configuration returns (e.g., structure, format) or handle edge cases. For a read/parse tool with 2 parameters, more context is needed to guide effective 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?

Schema description coverage is 100%, so the schema already documents both parameters (projectPath and configPath). The description adds no additional meaning beyond implying these paths relate to the config file, but doesn't clarify usage (e.g., if both are optional or how they interact). Baseline 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 verb 'Read and parse' and the resource 'current Detox configuration file', specifying file types (.detoxrc.js or similar). It distinguishes from siblings like detox_create_config (creation) and detox_validate_config (validation), but doesn't explicitly contrast with detox_list_configurations which might overlap in purpose.

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 detox_list_configurations or detox_validate_config. The description implies usage for reading configuration but provides no context on prerequisites, typical scenarios, or exclusions.

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