detox_list_configurations
List available Detox configurations for mobile testing projects to identify setup options for React Native E2E testing.
Instructions
List all available Detox configurations (e.g., ios.sim.debug, android.emu.debug).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectPath | No | Path to project root |
Implementation Reference
- src/tools/index.ts:205-230 (handler)Primary handler function for the detox_list_configurations tool. Parses arguments, reads Detox config using helper, lists configurations, and returns success/error with list.
export const listConfigurationsTool: Tool = { name: "detox_list_configurations", description: "List all available Detox configurations (e.g., ios.sim.debug, android.emu.debug).", inputSchema: zodToJsonSchema(ListConfigurationsArgsSchema), handler: async (args: z.infer<typeof ListConfigurationsArgsSchema>) => { const parsed = ListConfigurationsArgsSchema.parse(args); const projectPath = parsed.projectPath || process.cwd(); const result = await readDetoxConfig(projectPath); if (!result) { return { success: false, error: "No Detox configuration found.", configurations: [], }; } const configurations = listConfigurations(result.config); return { success: true, configurations, }; }, }; - src/utils/validators.ts:54-58 (schema)Zod schema defining the input parameters for the tool: optional projectPath string.
export const ListConfigurationsArgsSchema = z.object({ projectPath: z.string().optional().describe("Path to project root"), }); export type ListConfigurationsArgs = z.infer<typeof ListConfigurationsArgsSchema>; - src/tools/index.ts:429-442 (registration)The tool is registered by inclusion in the allTools array, imported and served via MCP ListTools and CallTool handlers in src/index.ts.
export const allTools: Tool[] = [ buildTool, testTool, initTool, readConfigTool, listConfigurationsTool, validateConfigTool, createConfigTool, listDevicesTool, generateTestTool, generateMatcherTool, generateActionTool, generateExpectationTool, ]; - src/utils/config-parser.ts:125-148 (helper)Core helper function that parses a DetoxConfig object and returns a list of available configurations with details.
export function listConfigurations(config: DetoxConfig): Array<{ name: string; device: string; app: string; deviceType?: string; appType?: string; }> { if (!config.configurations) { return []; } return Object.entries(config.configurations).map(([name, conf]) => { const device = config.devices?.[conf.device]; const app = config.apps?.[conf.app]; return { name, device: conf.device, app: conf.app, deviceType: device?.type, appType: app?.type, }; }); } - src/utils/config-parser.ts:105-120 (helper)Helper function to find, read, and parse the Detox configuration file from the project path.
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}`); } }