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, ];

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