Skip to main content
Glama
andreahaku
by andreahaku

simulator.erase

Factory reset an iOS simulator by erasing all content and settings to restore it to a clean state for testing.

Instructions

Erase all content and settings from a simulator (factory reset)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deviceYesDevice name or UDID to erase.

Implementation Reference

  • Core handler function that erases the simulator device by shutting it down if necessary and calling simctl erase.
    export async function eraseDevice(nameOrUdid: string): Promise<void> { logger.info("simulator", `Erasing simulator: ${nameOrUdid}`); const device = await findDevice(nameOrUdid); if (!device) { throw createError("SIM_NOT_FOUND", `Simulator not found: ${nameOrUdid}`, { details: "Use simulator.list_devices to see available simulators", }); } // Must be shut down before erasing if (device.state !== "Shutdown") { await shutdownDevice(device.udid); } const result = await simctl(["erase", device.udid]); if (result.exitCode !== 0) { const { code, message } = parseSimctlError(result.stderr); throw createError(code, message, { details: result.stderr }); } logger.info("simulator", `Device ${device.name} erased successfully`); }
  • Registers the 'simulator.erase' tool with MCP server, providing description, input schema, and thin wrapper handler that delegates to eraseDevice.
    server.tool( "simulator.erase", "Erase all content and settings from a simulator (factory reset)", SimulatorEraseInputSchema.shape, async (args) => { try { await eraseDevice(args.device); return { content: [ { type: "text", text: JSON.stringify({ success: true, message: `Device ${args.device} erased` }), }, ], }; } catch (error) { return handleToolError(error); } } );
  • Zod schema defining the input for the simulator.erase tool: requires a 'device' string (name or UDID).
    export const SimulatorEraseInputSchema = z.object({ device: z.string().describe("Device name or UDID to erase."), });

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/andreahaku/expo_ios_development_mcp'

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