Skip to main content
Glama
devyhan
by devyhan

simctl-manager

Manage iOS simulators via command-line operations using the Xcode MCP Server. Execute actions like list, create, boot, shutdown, erase, install, launch, and delete simulators efficiently.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYesSimCtl 명령어
extraArgsNo추가 simctl 인자들

Implementation Reference

  • The async handler function for the 'simctl-manager' tool. It builds an 'xcrun simctl' command using the provided 'command' and 'extraArgs', executes it via executeCommand, and returns the stdout/stderr output or an error response.
    async ({ command, extraArgs = [] }) => { try { console.error(`SimCtl 명령 실행: ${command}`); let simctlCommand = `xcrun simctl ${command}`; // 추가 인자 추가 if (extraArgs.length > 0) { simctlCommand += " " + extraArgs.join(" "); } console.error(`실행할 SimCtl 명령어: ${simctlCommand}`); // 명령어 실행 try { const { stdout, stderr } = await executeCommand(simctlCommand); let resultText = "SimCtl 결과:\n"; if (stdout) resultText += `${stdout}\n`; if (stderr) resultText += `${stderr}\n`; return { content: [{ type: "text", text: resultText }] }; } catch (error: any) { throw error; } } catch (error: any) { console.error(`SimCtl 오류: ${error.message}`); return { content: [{ type: "text", text: `SimCtl 명령 실행 중 오류가 발생했습니다:\n${error.message}\n${error.stderr || ''}` }], isError: true }; } }
  • Zod schema defining inputs for simctl-manager: 'command' as enum of simctl actions, optional 'extraArgs' as array of strings.
    { command: z.enum(["list", "create", "boot", "shutdown", "erase", "install", "launch", "delete"]).describe("SimCtl 명령어"), extraArgs: z.array(z.string()).optional().describe("추가 simctl 인자들") },
  • src/index.ts:500-544 (registration)
    The server.tool() call that registers the 'simctl-manager' tool with its schema and handler function.
    "simctl-manager", { command: z.enum(["list", "create", "boot", "shutdown", "erase", "install", "launch", "delete"]).describe("SimCtl 명령어"), extraArgs: z.array(z.string()).optional().describe("추가 simctl 인자들") }, async ({ command, extraArgs = [] }) => { try { console.error(`SimCtl 명령 실행: ${command}`); let simctlCommand = `xcrun simctl ${command}`; // 추가 인자 추가 if (extraArgs.length > 0) { simctlCommand += " " + extraArgs.join(" "); } console.error(`실행할 SimCtl 명령어: ${simctlCommand}`); // 명령어 실행 try { const { stdout, stderr } = await executeCommand(simctlCommand); let resultText = "SimCtl 결과:\n"; if (stdout) resultText += `${stdout}\n`; if (stderr) resultText += `${stderr}\n`; return { content: [{ type: "text", text: resultText }] }; } catch (error: any) { throw error; } } catch (error: any) { console.error(`SimCtl 오류: ${error.message}`); return { content: [{ type: "text", text: `SimCtl 명령 실행 중 오류가 발생했습니다:\n${error.message}\n${error.stderr || ''}` }], isError: true }; } } );
  • Supporting utility function executeCommand used by the simctl-manager handler to safely run shell commands like xcrun simctl.
    export async function executeCommand(command: string, workingDir?: string, timeout: number = 60000) { try { console.error(`명령어 실행: ${command} in ${workingDir || 'current directory'}`); // 보안 상의 이유로 위험한 명령어 필터링 if (/rm\s+-rf\s+\//.test(command) || /mkfs/.test(command) || /dd\s+if/.test(command)) { throw new Error("보안상의 이유로 이 명령어를 실행할 수 없습니다."); } const options = { cwd: workingDir, timeout: timeout, // 버퍼 제한 제거 maxBuffer: Infinity }; const { stdout, stderr } = await execPromise(command, options); return { stdout, stderr }; } catch (error: any) { console.error(`명령어 실행 오류: ${error.message}`); throw error; }

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/devyhan/xcode-mcp'

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