Skip to main content
Glama

detox_create_config

Generate a Detox configuration file to set up end-to-end testing for React Native mobile applications across specified platforms.

Instructions

Generate a new Detox configuration file for your React Native project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesPath to project root
platformsYesPlatforms to configure
appNameNoApplication name
bundleIdNoiOS bundle identifier
packageNameNoAndroid package name

Implementation Reference

  • The main handler function for the detox_create_config tool. It validates input args, generates a default Detox config using generateDefaultConfig, formats it as a .detoxrc.js module, writes it to the project path, and returns the config path and details.
    export const createConfigTool: Tool = {
      name: "detox_create_config",
      description: "Generate a new Detox configuration file for your React Native project.",
      inputSchema: zodToJsonSchema(CreateConfigArgsSchema),
      handler: async (args: z.infer<typeof CreateConfigArgsSchema>) => {
        const parsed = CreateConfigArgsSchema.parse(args);
    
        const config = generateDefaultConfig({
          platforms: parsed.platforms,
          appName: parsed.appName,
          bundleId: parsed.bundleId,
          packageName: parsed.packageName,
        });
    
        const configContent = `/** @type {import('detox').DetoxConfig} */
    module.exports = ${JSON.stringify(config, null, 2)};
    `;
    
        const configPath = `${parsed.projectPath}/.detoxrc.js`;
    
        await writeFile(configPath, configContent, "utf-8");
    
        return {
          success: true,
          configPath,
          config,
          message: `Configuration created at ${configPath}`,
        };
      },
    };
  • Zod schema defining the input parameters for the detox_create_config tool, including required projectPath and platforms, and optional app details.
    export const CreateConfigArgsSchema = z.object({
      projectPath: z.string().describe("Path to project root"),
      platforms: z.array(z.enum(["ios", "android"])).describe("Platforms to configure"),
      appName: z.string().optional().describe("Application name"),
      bundleId: z.string().optional().describe("iOS bundle identifier"),
      packageName: z.string().optional().describe("Android package name"),
    });
    
    export type CreateConfigArgs = z.infer<typeof CreateConfigArgsSchema>;
  • Core helper function that constructs a complete default Detox configuration object based on the selected platforms, populating devices, apps, and configurations with standard paths and commands.
    export function generateDefaultConfig(options: {
      platforms: ("ios" | "android")[];
      appName?: string;
      bundleId?: string;
      packageName?: string;
    }): DetoxConfig {
      const config: DetoxConfig = {
        testRunner: "jest",
        artifacts: {
          rootDir: "./artifacts",
          plugins: {
            screenshot: "failing",
            video: "failing",
            log: "failing",
          },
        },
        devices: {},
        apps: {},
        configurations: {},
      };
    
      const appName = options.appName || "MyApp";
    
      if (options.platforms.includes("ios")) {
        config.devices!["ios.simulator"] = {
          type: "ios.simulator",
          device: { type: "iPhone 15" },
        };
    
        config.apps!["ios.debug"] = {
          type: "ios.app",
          binaryPath: `ios/build/Build/Products/Debug-iphonesimulator/${appName}.app`,
          build: `xcodebuild -workspace ios/${appName}.xcworkspace -scheme ${appName} -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build`,
        };
    
        config.configurations!["ios.sim.debug"] = {
          device: "ios.simulator",
          app: "ios.debug",
        };
      }
    
      if (options.platforms.includes("android")) {
        config.devices!["android.emulator"] = {
          type: "android.emulator",
          avdName: "Pixel_4_API_30",
        };
    
        config.apps!["android.debug"] = {
          type: "android.apk",
          binaryPath: "android/app/build/outputs/apk/debug/app-debug.apk",
          build: "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug",
        };
    
        config.configurations!["android.emu.debug"] = {
          device: "android.emulator",
          app: "android.debug",
        };
      }
    
      return config;
    }
  • Registration of the detox_create_config tool (as createConfigTool) in the allTools array, which is imported into src/index.ts and used by the MCP server for listing and calling tools.
    export const allTools: Tool[] = [
      buildTool,
      testTool,
      initTool,
      readConfigTool,
      listConfigurationsTool,
      validateConfigTool,
      createConfigTool,
      listDevicesTool,
      generateTestTool,
      generateMatcherTool,
      generateActionTool,
      generateExpectationTool,
    ];
  • src/index.ts:50-94 (registration)
    MCP server request handler for calling tools, which finds the tool by name from allTools and invokes its handler.
    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,
        };
      }
    });
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 generates a file but doesn't mention whether this overwrites existing files, requires specific permissions, has side effects, or details the output format. For a file creation tool with zero annotation coverage, this is a significant gap in transparency.

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 unnecessary words. It is front-loaded and appropriately sized, making it easy to understand quickly.

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 the tool involves file generation with 5 parameters, no annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like file overwriting, error handling, or output details, leaving gaps for an AI agent to understand the tool fully in context.

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 5 parameters with descriptions. The description adds no additional meaning beyond implying configuration generation, but it doesn't explain parameter interactions or usage examples. Baseline 3 is appropriate when the schema handles parameter documentation adequately.

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 ('Generate') and resource ('new Detox configuration file for your React Native project'), making the purpose evident. However, it doesn't explicitly differentiate from sibling tools like 'detox_init' or 'detox_read_config', which might have overlapping or related functionality, preventing a perfect score.

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 like 'detox_init' (which might initialize a project) or 'detox_read_config' (which reads existing configs). It lacks context on prerequisites, such as whether a project must already be set up, or exclusions for when not to use it.

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