Skip to main content
Glama

set_sim_appearance

Change the appearance mode of an iOS simulator to dark or light using its UUID. Simplify simulator customization for testing environments.

Instructions

Sets the appearance mode (dark/light) of an iOS simulator.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeYesThe appearance mode to set (either "dark" or "light")
simulatorUuidYesUUID of the simulator to use (obtained from list_simulators)

Implementation Reference

  • The async handler function for the 'set_sim_appearance' tool. It logs the operation and calls the shared executeSimctlCommandAndRespond helper to execute the xcrun simctl ui command for setting the simulator's appearance mode.
    async (params: { simulatorUuid: string; mode: 'dark' | 'light' }): Promise<ToolResponse> => { log('info', `Setting simulator ${params.simulatorUuid} appearance to ${params.mode} mode`); return executeSimctlCommandAndRespond( params, ['ui', params.simulatorUuid, 'appearance', params.mode], 'Set Simulator Appearance', `Successfully set simulator ${params.simulatorUuid} appearance to ${params.mode} mode`, 'Failed to set simulator appearance', 'set simulator appearance', ); },
  • Zod input schema for the 'set_sim_appearance' tool, defining parameters simulatorUuid (string) and mode (enum: 'dark' | 'light').
    simulatorUuid: z .string() .describe('UUID of the simulator to use (obtained from list_simulators)'), mode: z .enum(['dark', 'light']) .describe('The appearance mode to set (either "dark" or "light")'), },
  • The registration function registerSetSimulatorAppearanceTool that registers the 'set_sim_appearance' tool on the MCP server using server.tool(), providing description, schema, and handler.
    export function registerSetSimulatorAppearanceTool(server: McpServer): void { server.tool( 'set_sim_appearance', 'Sets the appearance mode (dark/light) of an iOS simulator.', { simulatorUuid: z .string() .describe('UUID of the simulator to use (obtained from list_simulators)'), mode: z .enum(['dark', 'light']) .describe('The appearance mode to set (either "dark" or "light")'), }, async (params: { simulatorUuid: string; mode: 'dark' | 'light' }): Promise<ToolResponse> => { log('info', `Setting simulator ${params.simulatorUuid} appearance to ${params.mode} mode`); return executeSimctlCommandAndRespond( params, ['ui', params.simulatorUuid, 'appearance', params.mode], 'Set Simulator Appearance', `Successfully set simulator ${params.simulatorUuid} appearance to ${params.mode} mode`, 'Failed to set simulator appearance', 'set simulator appearance', ); }, ); }
  • Shared helper function executeSimctlCommandAndRespond used by multiple simulator tools, including set_sim_appearance, to validate parameters, execute xcrun simctl commands, log results, and return standardized ToolResponse.
    async function executeSimctlCommandAndRespond( params: { simulatorUuid: string; [key: string]: unknown }, simctlSubCommand: string[], operationDescriptionForXcodeCommand: string, successMessage: string, failureMessagePrefix: string, operationLogContext: string, extraValidation?: () => ToolResponse | null, ): Promise<ToolResponse> { const simulatorUuidValidation = validateRequiredParam( 'simulatorUuid', params.simulatorUuid as string, ); if (!simulatorUuidValidation.isValid) { return simulatorUuidValidation.errorResponse!; } if (extraValidation) { const validationResult = extraValidation(); if (validationResult) { return validationResult; } } try { const command = ['xcrun', 'simctl', ...simctlSubCommand]; const result = await executeCommand(command, operationDescriptionForXcodeCommand); if (!result.success) { const fullFailureMessage = `${failureMessagePrefix}: ${result.error}`; log( 'error', `${fullFailureMessage} (operation: ${operationLogContext}, simulator: ${params.simulatorUuid})`, ); return { content: [{ type: 'text', text: fullFailureMessage }], }; } log( 'info', `${successMessage} (operation: ${operationLogContext}, simulator: ${params.simulatorUuid})`, ); return { content: [{ type: 'text', text: successMessage }], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); const fullFailureMessage = `${failureMessagePrefix}: ${errorMessage}`; log( 'error', `Error during ${operationLogContext} for simulator ${params.simulatorUuid}: ${errorMessage}`, ); return { content: [{ type: 'text', text: fullFailureMessage }], }; } }
  • Configuration entry in the toolRegistrations array for conditionally registering the set_sim_appearance tool (via its register function) based on environment variable and tool group.
    register: registerSetSimulatorAppearanceTool, groups: [ToolGroup.SIMULATOR_MANAGEMENT], envVar: 'XCODEBUILDMCP_TOOL_SET_SIMULATOR_APPEARANCE', },

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/SampsonKY/XcodeBuildMCP'

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