Skip to main content
Glama

build_ios_sim_id_ws

Build an iOS app for a specific simulator using its UUID by providing a workspace path, scheme, and simulator ID. Supports custom configurations, derived data paths, and additional xcodebuild arguments.

Instructions

Builds an iOS app from a workspace for a specific simulator by UUID. IMPORTANT: Requires workspacePath, scheme, and simulatorId. Example: build_ios_sim_id_ws({ workspacePath: '/path/to/MyProject.xcworkspace', scheme: 'MyScheme', simulatorId: 'SIMULATOR_UUID' })

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
configurationNoBuild configuration (Debug, Release, etc.)
derivedDataPathNoPath where build products and other derived data will go
extraArgsNoAdditional xcodebuild arguments
preferXcodebuildNoIf true, prefers xcodebuild over the experimental incremental build system, useful for when incremental build system fails.
schemeYesThe scheme to use (Required)
simulatorIdYesUUID of the simulator to use (obtained from listSimulators) (Required)
useLatestOSNoWhether to use the latest OS version for the named simulator
workspacePathYesPath to the .xcworkspace file (Required)

Implementation Reference

  • Core handler logic for executing the iOS simulator build. Validates parameters indirectly through caller and invokes executeXcodeBuildCommand with platform set to iOSSimulator.
    async function _handleIOSSimulatorBuildLogic(params: { workspacePath?: string; projectPath?: string; scheme: string; configuration: string; simulatorName?: string; simulatorId?: string; useLatestOS: boolean; derivedDataPath?: string; extraArgs?: string[]; preferXcodebuild?: boolean; }): Promise<ToolResponse> { log('info', `Starting iOS Simulator build for scheme ${params.scheme} (internal)`); return executeXcodeBuildCommand( { ...params, }, { platform: XcodePlatform.iOSSimulator, simulatorName: params.simulatorName, simulatorId: params.simulatorId, useLatestOS: params.useLatestOS, logPrefix: 'iOS Simulator Build', }, params.preferXcodebuild, 'build', ); }
  • Tool module registration function that calls registerTool to add 'build_ios_sim_id_ws' to the MCP server with description, input schema, and inline handler performing validation and delegating to _handleIOSSimulatorBuildLogic.
    * Registers the iOS Simulator build by ID workspace tool */ export function registerIOSSimulatorBuildByIdWorkspaceTool(server: McpServer): void { type Params = { workspacePath: string; scheme: string; simulatorId: string; configuration?: string; derivedDataPath?: string; extraArgs?: string[]; useLatestOS?: boolean; preferXcodebuild?: boolean; }; registerTool<Params>( server, 'build_ios_sim_id_ws', "Builds an iOS app from a workspace for a specific simulator by UUID. IMPORTANT: Requires workspacePath, scheme, and simulatorId. Example: build_ios_sim_id_ws({ workspacePath: '/path/to/MyProject.xcworkspace', scheme: 'MyScheme', simulatorId: 'SIMULATOR_UUID' })", { workspacePath: workspacePathSchema, scheme: schemeSchema, simulatorId: simulatorIdSchema, configuration: configurationSchema, derivedDataPath: derivedDataPathSchema, extraArgs: extraArgsSchema, useLatestOS: useLatestOSSchema, preferXcodebuild: preferXcodebuildSchema, }, async (params: Params) => { // Validate required parameters const workspaceValidation = validateRequiredParam('workspacePath', params.workspacePath); if (!workspaceValidation.isValid) return workspaceValidation.errorResponse!; const schemeValidation = validateRequiredParam('scheme', params.scheme); if (!schemeValidation.isValid) return schemeValidation.errorResponse!; const simulatorIdValidation = validateRequiredParam('simulatorId', params.simulatorId); if (!simulatorIdValidation.isValid) return simulatorIdValidation.errorResponse!; // Provide defaults return _handleIOSSimulatorBuildLogic({ ...params, configuration: params.configuration ?? 'Debug', useLatestOS: params.useLatestOS ?? true, // May be ignored by xcodebuild preferXcodebuild: params.preferXcodebuild ?? false, }); }, ); }
  • Top-level server registration: includes the tool's module register function in toolRegistrations array, which is processed by registerTools(server) to conditionally register based on env var.
    register: registerIOSSimulatorBuildByIdWorkspaceTool, groups: [ToolGroup.IOS_SIMULATOR_WORKFLOW], envVar: 'XCODEBUILDMCP_TOOL_IOS_SIMULATOR_BUILD_BY_ID_WORKSPACE', },
  • Zod schemas for common tool parameters used in the build_ios_sim_id_ws tool, including workspacePathSchema, schemeSchema, simulatorIdSchema, configurationSchema, and others.
    export const workspacePathSchema = z.string().describe('Path to the .xcworkspace file (Required)'); export const projectPathSchema = z.string().describe('Path to the .xcodeproj file (Required)'); export const schemeSchema = z.string().describe('The scheme to use (Required)'); export const configurationSchema = z .string() .optional() .describe('Build configuration (Debug, Release, etc.)'); export const derivedDataPathSchema = z .string() .optional() .describe('Path where build products and other derived data will go'); export const extraArgsSchema = z .array(z.string()) .optional() .describe('Additional xcodebuild arguments'); export const simulatorNameSchema = z .string() .describe("Name of the simulator to use (e.g., 'iPhone 16') (Required)"); export const simulatorIdSchema = z .string() .describe('UUID of the simulator to use (obtained from listSimulators) (Required)'); export const useLatestOSSchema = z .boolean() .optional() .describe('Whether to use the latest OS version for the named simulator'); export const appPathSchema = z .string() .describe('Path to the .app bundle (full path to the .app directory)'); export const bundleIdSchema = z .string() .describe("Bundle identifier of the app (e.g., 'com.example.MyApp')"); export const launchArgsSchema = z .array(z.string()) .optional() .describe('Additional arguments to pass to the app'); export const preferXcodebuildSchema = z .boolean() .optional() .describe( 'If true, prefers xcodebuild over the experimental incremental build system, useful for when incremental build system fails.', );
  • Utility function registerTool used to register all MCP tools, wrapping the handler to match MCP server.tool signature.
    export function registerTool<T extends object>( server: McpServer, name: string, description: string, schema: Record<string, z.ZodType>, handler: (params: T) => Promise<ToolResponse>, ): void { // Create a wrapper handler that matches the signature expected by server.tool const wrappedHandler = ( args: Record<string, unknown>, _extra: unknown, ): Promise<ToolResponse> => { // Assert the type *before* calling the original handler // This confines the type assertion to one place const typedParams = args as T; return handler(typedParams); }; server.tool(name, description, schema, wrappedHandler); }

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