Skip to content

Commit 9ddf2d5

Browse files
authored
Chore/refactor tools (#183)
* Add tool audit option * More tool descriptions more concise * Move redundent tool arguments to session-defaults * Add manage-workflows tool to allow agents to add new workflows at run-time Also renames describe-ui tool to snapshot-ui tool. * Remnove redundent workflow name
1 parent a384098 commit 9ddf2d5

File tree

175 files changed

+5517
-1291
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+5517
-1291
lines changed

.cursorrules

Lines changed: 0 additions & 1 deletion
This file was deleted.

.vscode/extensions.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
{
22
"recommendations": [
3-
"dbaeumer.vscode-eslint"
4-
],
5-
"unwantedRecommendations": [
3+
"dbaeumer.vscode-eslint",
64
"esbenp.prettier-vscode"
75
]
86
}

.vscode/settings.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
"editor.codeActionsOnSave": {
2121
"source.fixAll.eslint": "explicit"
2222
},
23-
"editor.defaultFormatter": "vscode.typescript-language-features",
23+
"editor.defaultFormatter": "esbenp.prettier-vscode",
2424
"[typescript]": {
25-
"editor.defaultFormatter": "vscode.typescript-language-features"
25+
"editor.defaultFormatter": "esbenp.prettier-vscode"
2626
},
2727
"[javascript]": {
28-
"editor.defaultFormatter": "vscode.typescript-language-features"
28+
"editor.defaultFormatter": "esbenp.prettier-vscode"
2929
},
3030
"terminal.integrated.shellIntegration.decorationsEnabled": "never",
3131
"[json]": {

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
- Add DAP-based debugger backend and simulator debugging toolset (attach, breakpoints, stack, variables, LLDB command).
77
- Add session-status MCP resource with session identifiers.
88
- Add UI automation guard that blocks UI tools when the debugger is paused.
9+
- Add manage-workflows tool for live workflow selection updates.
910

1011
### Changed
1112
- Migrate to Zod v4.
1213
- Improve session default handling (reconcile mutual exclusivity and ignore explicit undefined clears).
14+
- Auto-include workflow-discovery when workflow selection is configured.
1315

1416
### Fixed
1517
- Update UI automation guard guidance to point at `debug_continue` when paused.

docs/CONFIGURATION.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ XcodeBuildMCP is configured through environment variables provided by your MCP c
1717

1818
## Workflow selection
1919

20-
By default, XcodeBuildMCP loads all tools at startup. If you want a smaller tool surface for a specific workflow, set `XCODEBUILDMCP_ENABLED_WORKFLOWS` to a comma-separated list of workflow directory names. The `session-management` workflow is always auto-included since other tools depend on it.
20+
By default, XcodeBuildMCP loads all tools at startup. If you want a smaller tool surface for a specific workflow, set `XCODEBUILDMCP_ENABLED_WORKFLOWS` to a comma-separated list of workflow directory names. The `session-management` workflow is always auto-included since other tools depend on it. When `XCODEBUILDMCP_DEBUG=true`, the `doctor` workflow is also auto-included.
2121

2222
**Available workflows:**
2323
- `device` (14 tools) - iOS Device Development
@@ -28,6 +28,7 @@ By default, XcodeBuildMCP loads all tools at startup. If you want a smaller tool
2828
- `project-scaffolding` (2 tools) - Project Scaffolding
2929
- `utilities` (1 tool) - Project Utilities
3030
- `session-management` (3 tools) - session-management
31+
- `workflow-discovery` (1 tool) - Workflow Discovery
3132
- `debugging` (8 tools) - Simulator Debugging
3233
- `simulator-management` (8 tools) - Simulator Management
3334
- `swift-package` (6 tools) - Swift Package Manager
@@ -41,6 +42,12 @@ XcodeBuildMCP includes experimental support for incremental builds. This feature
4142
> [!IMPORTANT]
4243
> Incremental builds are highly experimental and your mileage may vary. Please report issues to the [issue tracker](https://github.com/cameroncooke/XcodeBuildMCP/issues).
4344
45+
## Experimental workflow discovery
46+
47+
Set `XCODEBUILDMCP_EXPERIMENTAL_WORKFLOW_DISCOVERY=true` to auto-include the `workflow-discovery` workflow at startup.
48+
49+
The workflow discovery tool lets agents and clients enable or disable workflows at runtime. This can reduce upfront context by loading only what is needed as the session evolves. Note: most clients do not yet support the MCP notifications required for an agent harness to re-query the tool list after changes.
50+
4451
## Session-aware opt-out
4552

4653
By default, XcodeBuildMCP uses a session-aware mode: the LLM (or client) sets shared defaults once (simulator, device, project/workspace, scheme, etc.), and all tools reuse them. This cuts context bloat not just in each call payload, but also in the tool schemas themselves.

docs/TOOLS.md

Lines changed: 79 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,125 +1,129 @@
11
# XcodeBuildMCP Tools Reference
22

3-
XcodeBuildMCP provides 71 tools organized into 13 workflow groups for comprehensive Apple development workflows.
3+
XcodeBuildMCP provides 72 tools organized into 14 workflow groups for comprehensive Apple development workflows.
44

55
## Workflow Groups
66

77
### iOS Device Development (`device`)
88
**Purpose**: Complete iOS development workflow for both .xcodeproj and .xcworkspace files targeting physical devices (iPhone, iPad, Apple Watch, Apple TV, Apple Vision Pro). Build, test, deploy, and debug apps on real hardware. (7 tools)
99

10-
- `build_device` - Builds an app for a connected device.
11-
- `get_device_app_path` - Retrieves the built app path for a connected device.
12-
- `install_app_device` - Installs an app on a connected device.
13-
- `launch_app_device` - Launches an app on a connected device.
14-
- `list_devices` - Lists connected physical Apple devices (iPhone, iPad, Apple Watch, Apple TV, Apple Vision Pro) with their UUIDs, names, and connection status. Use this to discover physical devices for testing.
15-
- `stop_app_device` - Stops a running app on a connected device.
16-
- `test_device` - Runs tests on a physical Apple device.
10+
- `build_device` - Build for device.
11+
- `get_device_app_path` - Get device built app path.
12+
- `install_app_device` - Install app on device.
13+
- `launch_app_device` - Launch app on device.
14+
- `list_devices` - List connected devices.
15+
- `stop_app_device` - Stop device app.
16+
- `test_device` - Test on device.
1717
### iOS Simulator Development (`simulator`)
1818
**Purpose**: Complete iOS development workflow for both .xcodeproj and .xcworkspace files targeting simulators. Build, test, deploy, and interact with iOS apps on simulators. (12 tools)
1919

20-
- `boot_sim` - Boots an iOS simulator.
21-
- `build_run_sim` - Builds and runs an app on an iOS simulator.
22-
- `build_sim` - Builds an app for an iOS simulator.
23-
- `get_sim_app_path` - Retrieves the built app path for an iOS simulator.
24-
- `install_app_sim` - Installs an app in an iOS simulator.
25-
- `launch_app_logs_sim` - Launches an app in an iOS simulator and captures its logs.
26-
- `launch_app_sim` - Launches an app in an iOS simulator.
27-
- `list_sims` - Lists available iOS simulators with their UUIDs.
28-
- `open_sim` - Opens the iOS Simulator app.
29-
- `record_sim_video` - Starts or stops video capture for an iOS simulator.
30-
- `stop_app_sim` - Stops an app running in an iOS simulator.
31-
- `test_sim` - Runs tests on an iOS simulator.
20+
- `boot_sim` - Boot iOS simulator.
21+
- `build_run_sim` - Build and run iOS sim.
22+
- `build_sim` - Build for iOS sim.
23+
- `get_sim_app_path` - Get sim built app path.
24+
- `install_app_sim` - Install app on sim.
25+
- `launch_app_logs_sim` - Launch sim app with logs.
26+
- `launch_app_sim` - Launch app on simulator.
27+
- `list_sims` - List iOS simulators.
28+
- `open_sim` - Open Simulator app.
29+
- `record_sim_video` - Record sim video.
30+
- `stop_app_sim` - Stop sim app.
31+
- `test_sim` - Test on iOS sim.
3232
### Log Capture & Management (`logging`)
3333
**Purpose**: Log capture and management tools for iOS simulators and physical devices. Start, stop, and analyze application and system logs during development and testing. (4 tools)
3434

35-
- `start_device_log_cap` - Starts log capture on a connected device.
36-
- `start_sim_log_cap` - Starts capturing logs from a specified simulator. Returns a session ID. By default, captures only structured logs.
37-
- `stop_device_log_cap` - Stops an active Apple device log capture session and returns the captured logs.
38-
- `stop_sim_log_cap` - Stops an active simulator log capture session and returns the captured logs.
35+
- `start_device_log_cap` - Start device log capture.
36+
- `start_sim_log_cap` - Start sim log capture.
37+
- `stop_device_log_cap` - Stop device log capture.
38+
- `stop_sim_log_cap` - Stop sim log capture.
3939
### macOS Development (`macos`)
4040
**Purpose**: Complete macOS development workflow for both .xcodeproj and .xcworkspace files. Build, test, deploy, and manage macOS applications. (6 tools)
4141

42-
- `build_macos` - Builds a macOS app.
43-
- `build_run_macos` - Builds and runs a macOS app.
44-
- `get_mac_app_path` - Retrieves the built macOS app bundle path.
45-
- `launch_mac_app` - Launches a macOS application. Note: In some environments, this tool may be prefixed as mcp0_launch_macos_app.
46-
- `stop_mac_app` - Stops a running macOS application. Can stop by app name or process ID.
47-
- `test_macos` - Runs tests for a macOS target.
42+
- `build_macos` - Build macOS app.
43+
- `build_run_macos` - Build and run macOS app.
44+
- `get_mac_app_path` - Get macOS built app path.
45+
- `launch_mac_app` - Launch macOS app.
46+
- `stop_mac_app` - Stop macOS app.
47+
- `test_macos` - Test macOS target.
4848
### Project Discovery (`project-discovery`)
4949
**Purpose**: Discover and examine Xcode projects, workspaces, and Swift packages. Analyze project structure, schemes, build settings, and bundle information. (5 tools)
5050

5151
- `discover_projs` - Scans a directory (defaults to workspace root) to find Xcode project (.xcodeproj) and workspace (.xcworkspace) files.
52-
- `get_app_bundle_id` - Extracts the bundle identifier from an app bundle (.app) for any Apple platform (iOS, iPadOS, watchOS, tvOS, visionOS).
53-
- `get_mac_bundle_id` - Extracts the bundle identifier from a macOS app bundle (.app). Note: In some environments, this tool may be prefixed as mcp0_get_macos_bundle_id.
54-
- `list_schemes` - Lists schemes for a project or workspace.
55-
- `show_build_settings` - Shows xcodebuild build settings.
52+
- `get_app_bundle_id` - Extract bundle id from .app.
53+
- `get_mac_bundle_id` - Extract bundle id from macOS .app.
54+
- `list_schemes` - List Xcode schemes.
55+
- `show_build_settings` - Show build settings.
5656
### Project Scaffolding (`project-scaffolding`)
5757
**Purpose**: Tools for creating new iOS and macOS projects from templates. Bootstrap new applications with best practices, standard configurations, and modern project structures. (2 tools)
5858

59-
- `scaffold_ios_project` - Scaffold a new iOS project from templates. Creates a modern Xcode project with workspace structure, SPM package for features, and proper iOS configuration.
60-
- `scaffold_macos_project` - Scaffold a new macOS project from templates. Creates a modern Xcode project with workspace structure, SPM package for features, and proper macOS configuration.
59+
- `scaffold_ios_project` - Scaffold iOS project.
60+
- `scaffold_macos_project` - Scaffold macOS project.
6161
### Project Utilities (`utilities`)
6262
**Purpose**: Essential project maintenance utilities for cleaning and managing existing projects. Provides clean operations for both .xcodeproj and .xcworkspace files. (1 tools)
6363

64-
- `clean` - Cleans build products with xcodebuild.
64+
- `clean` - Clean build products.
6565
### session-management (`session-management`)
6666
**Purpose**: Manage session defaults for projectPath/workspacePath, scheme, configuration, simulatorName/simulatorId, deviceId, useLatestOS and arch. These defaults are required by many tools and must be set before attempting to call tools that would depend on these values. (3 tools)
6767

68-
- `session_clear_defaults` - Clear selected or all session defaults.
69-
- `session_set_defaults` - Set the session defaults needed by many tools. Most tools require one or more session defaults to be set before they can be used. Agents should set all relevant defaults up front in a single call (e.g., project/workspace, scheme, simulator or device ID, useLatestOS) to avoid iterative prompts; only set the keys your workflow needs.
70-
- `session_show_defaults` - Show current session defaults.
68+
- `session_clear_defaults` - Clear session defaults.
69+
- `session_set_defaults` - Set the session defaults, should be called at least once to set tool defaults.
70+
- `session_show_defaults` - Show session defaults.
7171
### Simulator Debugging (`debugging`)
7272
**Purpose**: Interactive iOS Simulator debugging tools: attach LLDB, manage breakpoints, inspect stack/variables, and run LLDB commands. (8 tools)
7373

74-
- `debug_attach_sim` - Attach LLDB to a running iOS simulator app. Provide bundleId or pid, plus simulator defaults.
75-
- `debug_breakpoint_add` - Add a breakpoint by file/line or function name for the active debug session.
76-
- `debug_breakpoint_remove` - Remove a breakpoint by id for the active debug session.
77-
- `debug_continue` - Resume execution in the active debug session or a specific debugSessionId.
78-
- `debug_detach` - Detach the current debugger session or a specific debugSessionId.
79-
- `debug_lldb_command` - Run an arbitrary LLDB command within the active debug session.
80-
- `debug_stack` - Return a thread backtrace from the active debug session.
81-
- `debug_variables` - Return variables for a selected frame in the active debug session.
74+
- `debug_attach_sim` - Attach LLDB to sim app.
75+
- `debug_breakpoint_add` - Add breakpoint.
76+
- `debug_breakpoint_remove` - Remove breakpoint.
77+
- `debug_continue` - Continue debug session.
78+
- `debug_detach` - Detach debugger.
79+
- `debug_lldb_command` - Run LLDB command.
80+
- `debug_stack` - Get backtrace.
81+
- `debug_variables` - Get frame variables.
8282
### Simulator Management (`simulator-management`)
8383
**Purpose**: Tools for managing simulators from booting, opening simulators, listing simulators, stopping simulators, erasing simulator content and settings, and setting simulator environment options like location, network, statusbar and appearance. (5 tools)
8484

85-
- `erase_sims` - Erases a simulator by UDID.
86-
- `reset_sim_location` - Resets the simulator's location to default.
87-
- `set_sim_appearance` - Sets the appearance mode (dark/light) of an iOS simulator.
88-
- `set_sim_location` - Sets a custom GPS location for the simulator.
89-
- `sim_statusbar` - Sets the data network indicator in the iOS simulator status bar. Use "clear" to reset all overrides, or specify a network type (hide, wifi, 3g, 4g, lte, lte-a, lte+, 5g, 5g+, 5g-uwb, 5g-uc).
85+
- `erase_sims` - Erase simulator.
86+
- `reset_sim_location` - Reset sim location.
87+
- `set_sim_appearance` - Set sim appearance.
88+
- `set_sim_location` - Set sim location.
89+
- `sim_statusbar` - Set sim status bar network.
9090
### Swift Package Manager (`swift-package`)
9191
**Purpose**: Swift Package Manager operations for building, testing, running, and managing Swift packages and dependencies. Complete SPM workflow support. (6 tools)
9292

93-
- `swift_package_build` - Builds a Swift Package with swift build
94-
- `swift_package_clean` - Cleans Swift Package build artifacts and derived data
95-
- `swift_package_list` - Lists currently running Swift Package processes
96-
- `swift_package_run` - Runs an executable target from a Swift Package with swift run
97-
- `swift_package_stop` - Stops a running Swift Package executable started with swift_package_run
98-
- `swift_package_test` - Runs tests for a Swift Package with swift test
93+
- `swift_package_build` - swift package target build.
94+
- `swift_package_clean` - swift package clean.
95+
- `swift_package_list` - List SwiftPM processes.
96+
- `swift_package_run` - swift package target run.
97+
- `swift_package_stop` - Stop SwiftPM run.
98+
- `swift_package_test` - Run swift package target tests.
9999
### System Doctor (`doctor`)
100100
**Purpose**: Debug tools and system doctor for troubleshooting XcodeBuildMCP server, development environment, and tool availability. (1 tools)
101101

102-
- `doctor` - Provides comprehensive information about the MCP server environment, available dependencies, and configuration status.
103-
### UI Testing & Automation (`ui-testing`)
102+
- `doctor` - MCP environment info.
103+
### UI Automation (`ui-automation`)
104104
**Purpose**: UI automation and accessibility testing tools for iOS simulators. Perform gestures, interactions, screenshots, and UI analysis for automated testing workflows. (11 tools)
105105

106-
- `button` - Press hardware button on iOS simulator. Supported buttons: apple-pay, home, lock, side-button, siri
107-
- `describe_ui` - Gets entire view hierarchy with precise frame coordinates (x, y, width, height) for all visible elements. Use this before UI interactions or after layout changes - do NOT guess coordinates from screenshots. Returns JSON tree with frame data for accurate automation. Requires the target process to be running; paused debugger/breakpoints can yield an empty tree.
108-
- `gesture` - Perform gesture on iOS simulator using preset gestures: scroll-up, scroll-down, scroll-left, scroll-right, swipe-from-left-edge, swipe-from-right-edge, swipe-from-top-edge, swipe-from-bottom-edge
109-
- `key_press` - Press a single key by keycode on the simulator. Common keycodes: 40=Return, 42=Backspace, 43=Tab, 44=Space, 58-67=F1-F10.
110-
- `key_sequence` - Press key sequence using HID keycodes on iOS simulator with configurable delay
111-
- `long_press` - Long press at specific coordinates for given duration (ms). Use describe_ui for precise coordinates (don't guess from screenshots).
112-
- `screenshot` - Captures screenshot for visual verification. For UI coordinates, use describe_ui instead (don't determine coordinates from screenshots).
113-
- `swipe` - Swipe from one point to another. Use describe_ui for precise coordinates (don't guess from screenshots). Supports configurable timing.
114-
- `tap` - Tap at specific coordinates or target elements by accessibility id or label. Use describe_ui to get precise element coordinates prior to using x/y parameters (don't guess from screenshots). Supports optional timing delays.
115-
- `touch` - Perform touch down/up events at specific coordinates. Use describe_ui for precise coordinates (don't guess from screenshots).
116-
- `type_text` - Type text (supports US keyboard characters). Use describe_ui to find text field, tap to focus, then type.
106+
- `button` - Press simulator hardware button.
107+
- `gesture` - Simulator gesture preset.
108+
- `key_press` - Press key by keycode.
109+
- `key_sequence` - Press a sequence of keys by their keycodes.
110+
- `long_press` - Long press at coords.
111+
- `screenshot` - Capture screenshot.
112+
- `snapshot_ui` - Print view hierarchy with precise view coordinates (x, y, width, height) for visible elements.
113+
- `swipe` - Swipe between points.
114+
- `tap` - Tap coordinate or element.
115+
- `touch` - Touch down/up at coords.
116+
- `type_text` - Type text.
117+
### workflow-discovery (`workflow-discovery`)
118+
**Purpose**: workflow-discovery related tools (1 tools)
119+
120+
- `manage_workflows` - Workflows are groups of tools exposed by XcodeBuildMCP. By default, not all workflows (and therefore tools) are enabled; only simulator tools are enabled by default. Some workflows are mandatory and can't be disabled. Available workflows: ${availableWorkflows}
117121

118122
## Summary Statistics
119123

120-
- **Total Tools**: 71 canonical tools + 22 re-exports = 93 total
121-
- **Workflow Groups**: 13
124+
- **Total Tools**: 72 canonical tools + 22 re-exports = 94 total
125+
- **Workflow Groups**: 14
122126

123127
---
124128

125-
*This documentation is automatically generated by `scripts/update-tools-docs.ts` using static analysis. Last updated: 2026-01-08*
129+
*This documentation is automatically generated by `scripts/update-tools-docs.ts` using static analysis. Last updated: 2026-01-25*

docs/dev/ARCHITECTURE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ XcodeBuildMCP is a Model Context Protocol (MCP) server that exposes Xcode operat
4747
4. **Plugin & Resource Loading (Runtime)**
4848
- At runtime, `loadPlugins()` and `loadResources()` use the generated loaders from the previous step
4949
- All workflow loaders are executed at startup to register tools
50-
- If `XCODEBUILDMCP_ENABLED_WORKFLOWS` is set, only those workflows (plus `session-management`) are registered
50+
- If `XCODEBUILDMCP_ENABLED_WORKFLOWS` is set, only those workflows (plus `session-management`) are registered; `workflow-discovery` is only auto-included when `XCODEBUILDMCP_EXPERIMENTAL_WORKFLOW_DISCOVERY=true`
5151

5252
5. **Tool Registration**
5353
- Discovered tools automatically registered with server using pre-generated maps

docs/dev/MANUAL_TESTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ fi
260260
- `test_*` tools - Run test suites
261261

262262
6. **UI Automation Tools** (depend on running apps):
263-
- `describe_ui`, `screenshot`, `tap`, etc.
263+
- `snapshot_ui`, `screenshot`, `tap`, etc.
264264

265265
**MANDATORY: Record Key Outputs**
266266

0 commit comments

Comments
 (0)