Skip to main content
Glama

set_sim_appearance

Change the visual theme of an iOS simulator by switching between dark and light appearance modes using the simulator's UUID.

Instructions

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

Input Schema

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

Implementation Reference

  • Registers the 'set_sim_appearance' tool with the MCP server, defining its description, input schema, and handler function.
    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',
          );
        },
      );
    }
  • The handler function for 'set_sim_appearance' that logs the action and delegates to executeSimctlCommandAndRespond to run 'xcrun simctl ui <uuid> 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 schema defining the input 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")'),
    },
  • Shared helper function that performs validation, executes simctl commands via executeCommand, handles success/error responses, and logging. Used by set_sim_appearance handler.
    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 }],
        };
      }
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It states the action is a 'set' operation, implying mutation, but doesn't disclose side effects (e.g., if it requires simulator to be running, permissions needed, or error handling). It lacks details on what happens if the simulator isn't available or if the change is persistent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without unnecessary words. Every part ('Sets', 'appearance mode', 'iOS simulator', 'dark/light') contributes directly to understanding the tool's function, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 2 parameters with full schema coverage and no output schema, the description is minimally adequate. It covers the basic purpose but lacks context on behavioral aspects (e.g., dependencies, effects) and usage guidelines. For a mutation tool with no annotations, more detail would improve completeness, but it's not entirely incomplete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with clear descriptions for both parameters (mode with enum values, simulatorUuid with source). The description adds no additional parameter semantics beyond what the schema provides, such as format details or examples. Baseline 3 is appropriate since the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Sets') and the target ('appearance mode of an iOS simulator'), with specific modes mentioned ('dark/light'). It distinguishes from siblings like 'boot_sim' or 'list_sims' by focusing on appearance configuration rather than lifecycle or listing. However, it doesn't explicitly differentiate from potential appearance-related tools (none in the list), so it's not a perfect 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a booted simulator), exclusions, or related tools for checking appearance. The context is implied through the action, but no explicit usage instructions are given.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.