Skip to main content
Glama

set_simulator_location

Set a custom GPS location in a simulator by specifying its UUID, latitude, and longitude to simulate specific geographical conditions for testing purposes.

Instructions

Sets a custom GPS location for the simulator.

Input Schema

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

Implementation Reference

  • Main handler logic: validates latitude/longitude ranges and executes the xcrun simctl location set command for the given simulator.
    export async function set_sim_locationLogic(
      params: SetSimulatorLocationParams,
      executor: CommandExecutor,
    ): Promise<ToolResponse> {
      const extraValidation = (): ToolResponse | null => {
        if (params.latitude < -90 || params.latitude > 90) {
          return {
            content: [
              {
                type: 'text',
                text: 'Latitude must be between -90 and 90 degrees',
              },
            ],
          };
        }
        if (params.longitude < -180 || params.longitude > 180) {
          return {
            content: [
              {
                type: 'text',
                text: 'Longitude must be between -180 and 180 degrees',
              },
            ],
          };
        }
        return null;
      };
    
      log(
        'info',
        `Setting simulator ${params.simulatorId} location to ${params.latitude},${params.longitude}`,
      );
    
      return executeSimctlCommandAndRespond(
        params,
        ['location', params.simulatorId, 'set', `${params.latitude},${params.longitude}`],
        'Set Simulator Location',
        `Successfully set simulator ${params.simulatorId} location to ${params.latitude},${params.longitude}`,
        'Failed to set simulator location',
        'set simulator location',
        executor,
        extraValidation,
      );
    }
  • Zod schema for input parameters: simulatorId (UUID), latitude, longitude with descriptions.
    const setSimulatorLocationSchema = z.object({
      simulatorId: z
        .string()
        .uuid()
        .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.'),
    });
  • Tool registration exporting the tool definition with name, description, schema, and wrapped handler using createSessionAwareTool.
    export default {
      name: 'set_sim_location',
      description: 'Sets a custom GPS location for the simulator.',
      schema: publicSchemaObject.shape, // MCP SDK compatibility
      handler: createSessionAwareTool<SetSimulatorLocationParams>({
        internalSchema: setSimulatorLocationSchema as unknown as z.ZodType<SetSimulatorLocationParams>,
        logicFunction: set_sim_locationLogic,
        getExecutor: getDefaultCommandExecutor,
        requirements: [{ allOf: ['simulatorId'], message: 'simulatorId is required' }],
      }),
    };
  • Helper function to execute simctl commands via xcrun, with logging, error handling, and optional extra validation.
    async function executeSimctlCommandAndRespond(
      params: SetSimulatorLocationParams,
      simctlSubCommand: string[],
      operationDescriptionForXcodeCommand: string,
      successMessage: string,
      failureMessagePrefix: string,
      operationLogContext: string,
      executor: CommandExecutor = getDefaultCommandExecutor(),
      extraValidation?: () => ToolResponse | null,
    ): Promise<ToolResponse> {
      if (extraValidation) {
        const validationResult = extraValidation();
        if (validationResult) {
          return validationResult;
        }
      }
    
      try {
        const command = ['xcrun', 'simctl', ...simctlSubCommand];
        const result = await executor(command, operationDescriptionForXcodeCommand, true, {});
    
        if (!result.success) {
          const fullFailureMessage = `${failureMessagePrefix}: ${result.error}`;
          log(
            'error',
            `${fullFailureMessage} (operation: ${operationLogContext}, simulator: ${params.simulatorId})`,
          );
          return {
            content: [{ type: 'text', text: fullFailureMessage }],
          };
        }
    
        log(
          'info',
          `${successMessage} (operation: ${operationLogContext}, simulator: ${params.simulatorId})`,
        );
        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.simulatorId}: ${errorMessage}`,
        );
        return {
          content: [{ type: 'text', text: fullFailureMessage }],
        };
      }
    }
Behavior2/5

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

With no annotations provided, the description carries full responsibility for behavioral disclosure. While 'Sets' implies a write operation, it doesn't specify whether this change is persistent across simulator sessions, requires specific simulator states, or has any confirmation/error handling. The description lacks critical behavioral context for a mutation tool.

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, focused sentence that efficiently communicates the core functionality without unnecessary words. It's appropriately sized for a straightforward tool and front-loads the essential information.

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?

For a mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens after setting the location, whether there's confirmation, error conditions, or how this interacts with other simulator operations. The context signals indicate this tool modifies system state, yet the description provides minimal operational context.

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?

With 100% schema description coverage, the input schema already documents all three parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema, maintaining the baseline score for high schema coverage situations.

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 immediately understandable. However, it doesn't explicitly differentiate from its sibling 'reset_simulator_location', which appears to be a related tool for reverting to default location settings.

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 location-related operations. There's no mention of prerequisites, side effects, or typical use cases, leaving the agent with insufficient context for decision-making.

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

Related 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/getsentry/XcodeBuildMCP'

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