Skip to main content
Glama

setDeviceMode

Configure device-specific parameters for test authoring and exploration modes on Android and iOS platforms. Set app IDs, mode persistence, and deep link skipping options.

Instructions

Set parameters for a particular device in a given mode.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deviceIdYesDevice ID for which these settings will apply.
explorationNo
platformYesTarget platform
testAuthoringNo

Implementation Reference

  • The handler function that executes the setDeviceMode tool logic by calling ConfigurationManager to update the device session.
    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 schema defining the input parameters for 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 in ToolRegistry with schema and handler.
    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); } } );
  • Core helper method in ConfigurationManager that sets the device configuration based on args and persists it.
    public async updateDeviceSession(args: DeviceSessionArgs, platform: "android" | "ios"): Promise<void> { let newConfig: DeviceConfig | undefined; if (args.testAuthoring) { newConfig = { platform: platform, activeMode: "testAuthoring", deviceId: args.deviceId, testAuthoring: { appId: args.testAuthoring.appId, description: args.testAuthoring.description, persist: args.testAuthoring.persist }, }; } else if (args.exploration) { newConfig = { platform: platform, activeMode: "exploration", deviceId: args.deviceId, exploration: { deepLinkSkipping: args.exploration.deepLinkSkipping, } }; } if (newConfig) { this.deviceSessionConfigs.set(args.deviceId, newConfig); } await this.saveAppConfigs(); }
  • Top-level call to registerConfigurationTools() which registers the setDeviceMode tool.
    registerConfigurationTools();

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