Skip to main content
Glama

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
NameRequiredDescriptionDefault
explorationNo
testAuthoringNo
deviceIdYesDevice ID for which these settings will apply.
platformYesTarget platform

Implementation Reference

  • 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") });
  • 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); } } );

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/zillow/auto-mobile'

If you have feedback or need assistance with the MCP directory API, please join our Discord server