Skip to main content
Glama

set_simulator_location

Set custom GPS coordinates for a simulator to test location-based features by specifying latitude and longitude.

Instructions

Sets a custom GPS location for the simulator.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
simulatorUuidYesUUID of the simulator to use (obtained from list_simulators)
latitudeYesThe latitude for the custom location.
longitudeYesThe longitude for the custom location.

Implementation Reference

  • The tool handler that performs extra validation on latitude/longitude, logs the operation, and calls the executeSimctlCommandAndRespond helper to run the 'simctl location set' command.
    async (params: {
      simulatorUuid: string;
      latitude: number;
      longitude: number;
    }): Promise<ToolResponse> => {
      const extraValidation = (): ToolResponse | null => {
        const latitudeValidation = validateRequiredParam('latitude', params.latitude);
        if (!latitudeValidation.isValid) {
          return latitudeValidation.errorResponse!;
        }
        const longitudeValidation = validateRequiredParam('longitude', params.longitude);
        if (!longitudeValidation.isValid) {
          return longitudeValidation.errorResponse!;
        }
        return null;
      };
    
      log(
        'info',
        `Setting simulator ${params.simulatorUuid} location to ${params.latitude},${params.longitude}`,
      );
    
      return executeSimctlCommandAndRespond(
        params,
        ['location', params.simulatorUuid, 'set', `${params.latitude},${params.longitude}`],
        'Set Simulator Location',
        `Successfully set simulator ${params.simulatorUuid} location to ${params.latitude},${params.longitude}`,
        'Failed to set simulator location',
        'set simulator location',
        extraValidation,
      );
    },
  • Zod schema for the tool's input parameters: simulatorUuid, latitude, and longitude.
    {
      simulatorUuid: z
        .string()
        .describe('UUID of the simulator to use (obtained from list_simulators)'),
      latitude: z.number().describe('The latitude for the custom location.'),
      longitude: z.number().describe('The longitude for the custom location.'),
    },
  • Local registration function that defines and registers the 'set_simulator_location' tool on the MCP server, including name, description, schema, and handler.
    export function registerSetSimulatorLocationTool(server: McpServer): void {
      server.tool(
        'set_simulator_location',
        'Sets a custom GPS location for the simulator.',
        {
          simulatorUuid: z
            .string()
            .describe('UUID of the simulator to use (obtained from list_simulators)'),
          latitude: z.number().describe('The latitude for the custom location.'),
          longitude: z.number().describe('The longitude for the custom location.'),
        },
        async (params: {
          simulatorUuid: string;
          latitude: number;
          longitude: number;
        }): Promise<ToolResponse> => {
          const extraValidation = (): ToolResponse | null => {
            const latitudeValidation = validateRequiredParam('latitude', params.latitude);
            if (!latitudeValidation.isValid) {
              return latitudeValidation.errorResponse!;
            }
            const longitudeValidation = validateRequiredParam('longitude', params.longitude);
            if (!longitudeValidation.isValid) {
              return longitudeValidation.errorResponse!;
            }
            return null;
          };
    
          log(
            'info',
            `Setting simulator ${params.simulatorUuid} location to ${params.latitude},${params.longitude}`,
          );
    
          return executeSimctlCommandAndRespond(
            params,
            ['location', params.simulatorUuid, 'set', `${params.latitude},${params.longitude}`],
            'Set Simulator Location',
            `Successfully set simulator ${params.simulatorUuid} location to ${params.latitude},${params.longitude}`,
            'Failed to set simulator location',
            'set simulator location',
            extraValidation,
          );
        },
      );
    }
  • Shared helper function for executing simctl commands in simulator tools: validates params, runs xcrun simctl command, handles responses and errors.
    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 }],
        };
      }
    }
  • Top-level registration configuration in toolRegistrations array; calls registerSetSimulatorLocationTool if environment variable is set.
    {
      register: registerSetSimulatorLocationTool,
      groups: [ToolGroup.SIMULATOR_MANAGEMENT],
      envVar: 'XCODEBUILDMCP_TOOL_SET_SIMULATOR_LOCATION',
    },
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool sets a custom GPS location, implying a mutation, but doesn't describe effects like whether this persists across simulator sessions, requires specific permissions, or has side effects. This leaves significant gaps in understanding the tool's behavior beyond the basic action.

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, direct sentence that efficiently conveys the core action without unnecessary words. It's front-loaded with the key information, making it highly concise and well-structured for quick understanding.

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

Completeness2/5

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

Given the complexity of a mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens after setting the location (e.g., success/failure indicators, error conditions, or how to verify the change), leaving the agent without enough context for reliable use.

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?

The input schema has 100% description coverage, with clear parameter documentation (e.g., 'UUID of the simulator to use', 'latitude', 'longitude'). The description adds no additional parameter details beyond what the schema provides, so it meets the baseline score of 3 for high schema coverage without adding extra value.

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 target ('custom GPS location for the simulator'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'reset_simulator_location', which appears to be a related reset function, so it misses the highest clarity level.

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 like 'reset_simulator_location' or other simulator-related tools in the sibling list. It lacks context about prerequisites, such as needing a running simulator or valid UUID, and offers no explicit when-not-to-use advice.

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

Install Server

Other Tools

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