Add iOS physical device discovery for testing workflows#62
Add iOS physical device discovery for testing workflows#62cameroncooke merged 2 commits intomainfrom
Conversation
- Add device listing tool with devicectl/xctrace fallback - Enable LLMs to discover connected Apple devices before running tests - Register in iOS device workflow and project discovery groups - Supports all Apple platforms (iOS, iPadOS, watchOS, tvOS, visionOS) - Clean sectioned output showing available vs unavailable devices - Consistent naming with existing list_sims tool 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull Request Overview
This PR adds iOS physical device discovery and testing capabilities while enhancing various device and build tool integrations and documentation. Key changes include:
- Introducing a new tool (list_ios_devices) and updating tool-group registrations to support physical device management.
- Modifying build utilities to support device-specific destination strings based on an optional deviceId parameter.
- Enhancing test tools and updating documentation/configuration files to reflect the new device management and error response behavior.
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test-multiblock-server.js | Added MCP server test tools for multiple content block responses. |
| src/utils/tool-groups.ts | Added a new group for physical DEVICE_MANAGEMENT. |
| src/utils/register-tools.ts | Updated tool registrations to add device test and log capture tools. |
| src/utils/build-utils.ts | Added optional deviceId handling for iOS, watchOS, tvOS, and visionOS build commands. |
| src/types/common.ts | Extended PlatformBuildOptions with an optional deviceId property. |
| src/tools/test_ios_device.ts / test_common.ts | Updated device test tools to require and pass deviceId in test workflows. |
| src/tools/device_log.ts | New module to capture and manage device logs using devicectl. |
| src/tools/bundleId.ts / src/tools/app_path.ts | Updated next-step instructions for device deployment. |
| Example project files and configuration updates | Updated bundle identifiers, signing, and project configuration for physical devices. |
| devices.txt, claude-code-multiblock-error-issue.md | Added sample device output and documented a known error response truncation issue. |
| TESTING_TASK_DOCUMENT.md and README.md | Updated testing documentation and added code signing instructions for device deployment. |
Comments suppressed due to low confidence (1)
src/utils/build-utils.ts:149
- Consider refactoring the repeated destination string construction logic for platforms with optional deviceId into a helper function. This will reduce duplication and improve maintainability across the similar branches for iOS, watchOS, tvOS, and visionOS.
if (platformOptions.deviceId) { destinationString = `platform=iOS,id=${platformOptions.deviceId}`; } else { destinationString = 'generic/platform=iOS'; }
|
@codegen can you review this PR?
|
🔍 PR Review SummaryI've completed a thorough review of this PR. Overall, this is an excellent addition that fills a critical gap in the XcodeBuildMCP ecosystem! 🎉 ✅ Strengths1. Addresses Real Need
2. Robust Implementation
3. Excellent Integration
4. Thorough Testing
📋 Code Quality ObservationsDevice Discovery (
Tool Registration (
Documentation Updates
🎯 Minor Suggestions
🚀 Impact AssessmentThis PR significantly enhances XcodeBuildMCP's capabilities:
The implementation is production-ready and follows established patterns in the codebase. ✅ RecommendationAPPROVE - This is a well-implemented, thoroughly tested feature that addresses a real gap in the iOS device workflow. The code quality is high and the integration is clean. Suggested next steps:
|
| 'List Devices (devicectl with JSON)', | ||
| ); | ||
|
|
||
| if (result.success) { |
There was a problem hiding this comment.
👍 Excellent approach! Using devicectl with JSON output first, then falling back to xctrace ensures compatibility across different Xcode versions. This handles the transition period where teams might be on different Xcode versions.
| device.visibilityClass === 'Simulator' || | ||
| !device.connectionProperties?.pairingState | ||
| ) { | ||
| continue; |
There was a problem hiding this comment.
🛡️ Good defensive programming! Filtering out simulators and unpaired devices ensures the tool focuses on actual physical devices that are ready for deployment. This prevents confusion with simulator UUIDs.
| responseText += '🔗 Paired but Not Connected:\n'; | ||
| for (const device of pairedDevices) { | ||
| responseText += `\n📱 ${device.name}\n`; | ||
| responseText += ` UDID: ${device.identifier}\n`; |
There was a problem hiding this comment.
📱 Love the sectioned output! Grouping devices by "Available", "Paired but Not Connected", and "Unpaired" gives LLMs clear guidance on which devices they can actually target for testing. The emoji indicators make it easy to scan.
| const errorMessage = error instanceof Error ? error.message : String(error); | ||
| log('error', `Error listing devices: ${errorMessage}`); | ||
| return { | ||
| content: [ |
There was a problem hiding this comment.
🎯 Smart next-step guidance! Only showing testing instructions when devices are actually available prevents LLMs from attempting operations on unavailable devices. The specific tool examples are very helpful.
| > [!IMPORTANT] | ||
| > Please note that incremental builds support is currently highly experimental and your mileage may vary. Please report any issues you encounter to the [issue tracker](https://github.com/cameroncooke/XcodeBuildMCP/issues). | ||
|
|
||
| ## Code Signing for Device Deployment |
There was a problem hiding this comment.
📚 Excellent addition! The code signing section is crucial for device deployment. Many developers struggle with this step, so having clear guidance upfront prevents frustration later in the workflow.
✅ PR Review Complete!I've thoroughly reviewed PR #62 and it's excellent work! 🎉 🌟 Key Highlights
📝 Review Summary
💡 Minor Cleanup Suggestions
🚀 ImpactThis PR transforms XcodeBuildMCP from having a broken device workflow to enabling complete Device Discovery → Build → Deploy → Test pipelines for LLMs. Recommendation: APPROVE and ready to merge! 🎯 Great work on this feature - it's exactly what the ecosystem needed! 👏 💻 View my work • React 👍 or 👎 |
Add complete physical device support with 5 new MCP tools for end-to-end iOS device workflows: • Device discovery and management via list_devices tool with JSON-based output • Native device building with build_ios_dev_proj/ws tools supporting incremental builds • App deployment via install_app_device and launch_app_device tools • Real-time console log capture with start/stop_device_log_cap session management • Physical device testing with test_ios_dev_proj/ws tools and detailed result parsing Key implementation details: - Standardized parameter naming (deviceId, bundleId, appPath) across all device tools - Added DEVICE_MANAGEMENT tool group for selective enablement parallel to simulator tools - Console output capture via xcrun devicectl with --terminate-existing flag for reliability - Proper error handling and session management for log capture workflows - Enhanced example iOS app with comprehensive startup and interaction logging Documentation and testing: - Updated README with device management features section and code signing prerequisites - Added code signing configuration guide for Xcode setup requirements - End-to-end tested complete device workflow: discover → build → install → launch → log capture → test - Verified console log capture works for both debugPrint and print statements
dfa8b1c to
da875c5
Compare
|
🎊 🥳 |
Summary
This PR adds the missing iOS physical device discovery capability that enables LLMs to effectively use the existing iOS device testing tools.
What's Added
list_ios_devicestool - Discovers connected physical iOS devices with UUIDs, names, and connection statusdevicectl(iOS 17+/Xcode 15+) withxctracefallback for compatibilityIOS_DEVICE_WORKFLOWandPROJECT_DISCOVERYtool groupslist_simsfor simulators)Why This is Needed
The existing iOS device testing infrastructure is excellent, but LLMs need to discover which physical devices are available before they can target them for testing. This tool provides that missing piece.
Before: LLMs couldn't discover physical devices to test against
After: LLMs can discover devices and use them with existing test tools
Example Usage
Design Decisions
list_simstool format (name + UUID in parentheses)list_simsTest Plan
test_ios_dev_wstools🤖 Generated with Claude Code