Skip to main content
Glama

reset_network_condition

Restore simulator network conditions to default settings by specifying the simulator UUID, ensuring stable testing environments.

Instructions

Resets network conditions to default in the simulator.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
simulatorUuidYesUUID of the simulator to use (obtained from list_simulators)

Implementation Reference

  • The handler function for the 'reset_network_condition' tool. It logs the action and invokes the shared executeSimctlCommandAndRespond helper to run 'xcrun simctl status_bar <uuid> clear'.
    async (params: { simulatorUuid: string }): Promise<ToolResponse> => { log('info', `Resetting simulator ${params.simulatorUuid} network condition`); return executeSimctlCommandAndRespond( params, ['status_bar', params.simulatorUuid, 'clear'], 'Reset Network Condition', `Successfully reset simulator ${params.simulatorUuid} network conditions.`, 'Failed to reset network condition', 'reset network condition', ); },
  • Zod input schema for the tool, requiring a 'simulatorUuid' string parameter.
    { simulatorUuid: z .string() .describe('UUID of the simulator to use (obtained from list_simulators)'), },
  • Direct registration function that registers the 'reset_network_condition' tool on the MCP server using server.tool(), including name, description, schema, and inline handler.
    export function registerResetNetworkConditionTool(server: McpServer): void { server.tool( 'reset_network_condition', 'Resets network conditions to default in the simulator.', { simulatorUuid: z .string() .describe('UUID of the simulator to use (obtained from list_simulators)'), }, async (params: { simulatorUuid: string }): Promise<ToolResponse> => { log('info', `Resetting simulator ${params.simulatorUuid} network condition`); return executeSimctlCommandAndRespond( params, ['status_bar', params.simulatorUuid, 'clear'], 'Reset Network Condition', `Successfully reset simulator ${params.simulatorUuid} network conditions.`, 'Failed to reset network condition', 'reset network condition', ); }, ); }
  • Entry in the toolRegistrations array that includes registerResetNetworkConditionTool for conditional registration based on the XCODEBUILDMCP_TOOL_RESET_NETWORK_CONDITION environment variable.
    { register: registerResetNetworkConditionTool, groups: [ToolGroup.SIMULATOR_MANAGEMENT], envVar: 'XCODEBUILDMCP_TOOL_RESET_NETWORK_CONDITION', },
  • Helper utility shared across simulator tools that validates simulatorUuid, optionally runs extra validation, executes 'xcrun simctl' commands via executeCommand, logs outcomes, and returns standardized ToolResponse objects.
    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 }], }; } }

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