setDeviceMode
Configure device parameters for mobile testing modes like exploration or test authoring to automate mobile app testing workflows.
Instructions
Set parameters for a particular device in a given mode.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| exploration | No | ||
| testAuthoring | No | ||
| deviceId | Yes | Device ID for which these settings will apply. | |
| platform | Yes | Target platform |
Implementation Reference
- src/server/configurationTools.ts:61-77 (handler)The handler function for the 'setDeviceMode' tool. It updates the device session configuration using ConfigurationManager.updateDeviceSession and returns a JSON response indicating success or failure.async (args: DeviceSessionArgs): Promise<any> => { try { // Update configuration with provided parameters await ConfigurationManager.getInstance().updateDeviceSession(args, args.platform); return createJSONToolResponse({ success: true, message: `Device configuration updated successfully` }); } catch (error) { logger.error("Failed to configure MCP server:", error); const result = { success: false, message: `Failed to configure MCP server: ${error}` }; return createJSONToolResponse(result); }
- Zod input schema (ConfigSchema) used for validating parameters of the 'setDeviceMode' tool.const ConfigSchema = z.object({ exploration: z.object({ deepLinkSkipping: z.boolean() }).optional(), testAuthoring: z.object({ appId: z.string().describe("App ID to be used for test authoring."), description: z.string().describe("Rough description of the test to be authored."), persist: z.enum(["never", "devicePresent", "always"]).describe("What conditions to stay in test authoring mode. Default devicePresent"), }).optional(), deviceId: z.string().describe("Device ID for which these settings will apply."), platform: z.enum(["android", "ios"]).describe("Target platform") });
- src/server/configurationTools.ts:57-79 (registration)Registration of the 'setDeviceMode' tool using ToolRegistry.register, including the name, description, schema, and inline handler function.ToolRegistry.register( "setDeviceMode", "Set parameters for a particular device in a given mode.", ConfigSchema, async (args: DeviceSessionArgs): Promise<any> => { try { // Update configuration with provided parameters await ConfigurationManager.getInstance().updateDeviceSession(args, args.platform); return createJSONToolResponse({ success: true, message: `Device configuration updated successfully` }); } catch (error) { logger.error("Failed to configure MCP server:", error); const result = { success: false, message: `Failed to configure MCP server: ${error}` }; return createJSONToolResponse(result); } } );