Xcode MCP Tool Reference
Complete reference for all 20 tools exposed by Xcode's MCP server (xcrun mcpbridge).
Important: Parameter schemas below are sourced from blog research and initial testing. Validate against your live mcpbridge with tools/list if behavior differs.
Discovery
XcodeListWindows
Call this first. Returns open Xcode windows with tabIdentifier values needed by most other tools.
- Parameters: None
- Returns: List of
{ tabIdentifier: string, workspacePath: string }
- Notes: No parameters needed. If empty, no project is open in Xcode.
XcodeListWindows()
→ { "tabIdentifier": "abc-123", "workspacePath": "/Users/dev/MyApp.xcodeproj" }
File Operations
XcodeRead
Read file contents from the project.
- Parameters:
path (string, required) — File path relative to project or absolute
- Returns: File contents as string
- Notes: Sees Xcode's project view including generated files and resolved SPM packages
XcodeWrite
Create a new file.
- Parameters:
path (string, required) — File path
content (string, required) — File contents
- Returns: Write confirmation
- Notes: Creates the file but does NOT add it to Xcode targets automatically. Use
XcodeUpdate for existing files.
XcodeUpdate
Edit an existing file with str_replace-style patches.
- Parameters:
path (string, required) — File path
patches (array, required) — Array of { oldText: string, newText: string } replacements
- Returns: Update confirmation
- Notes: Preferred over
XcodeWrite for editing existing files. Each patch must match exactly one location in the file.
XcodeGlob
Find files matching a pattern.
- Parameters:
pattern (string, required) — Glob pattern (e.g., **/*.swift)
- Returns: Array of matching file paths
- Notes: Searches within the Xcode project scope
XcodeGrep
Search file contents for a string or pattern.
- Parameters:
query (string, required) — Search term or pattern
scope (string, optional) — Limit search to specific directory/file
- Returns: Array of matches with file paths and line numbers
- Notes: Returns structured results, not raw grep output
XcodeLS
List directory contents.
- Parameters:
path (string, required) — Directory path
- Returns: Array of entries (files and subdirectories)
XcodeMakeDir
Create a directory.
- Parameters:
path (string, required) — Directory path to create
- Returns: Creation confirmation
- Notes: Creates intermediate directories as needed
XcodeRM
Delete a file or directory. DESTRUCTIVE.
- Parameters:
path (string, required) — Path to delete
- Returns: Deletion confirmation
- Notes: Irreversible. Always confirm with the user before calling.
XcodeMV
Move or rename a file. DESTRUCTIVE.
- Parameters:
sourcePath (string, required) — Current path
destinationPath (string, required) — New path
- Returns: Move confirmation
- Notes: May break imports and references. Confirm with user. Xcode may not automatically update references.
Build & Test
BuildProject
Build the Xcode project.
- Parameters:
tabIdentifier (string, required) — From XcodeListWindows
- Returns:
{ buildResult: string, elapsedTime: number, errors: array }
- Notes: Builds the active scheme. Check
buildResult for "succeeded" or "failed".
GetBuildLog
Retrieve build output after a build.
- Parameters:
tabIdentifier (string, required)
- Returns: Build log as string
- Notes: Contains raw compiler output. For structured diagnostics, prefer
XcodeListNavigatorIssues.
RunAllTests
Run the full test suite.
- Parameters:
tabIdentifier (string, required)
- Returns: Test results with pass/fail counts and failure details
- Notes: Runs all tests in the active scheme's test plan. Use
RunSomeTests for faster iteration.
RunSomeTests
Run specific test(s).
- Parameters:
tabIdentifier (string, required)
tests (array of strings, required) — Test identifiers (e.g., ["MyTests/testLogin"])
- Returns: Test results for the specified tests
- Notes: Much faster than
RunAllTests for iterative debugging. Use test identifiers from GetTestList.
GetTestList
List available tests.
- Parameters:
tabIdentifier (string, required)
- Returns: Array of test identifiers organized by test target/class
- Notes: Use the returned identifiers with
RunSomeTests.
Diagnostics
XcodeListNavigatorIssues
Get current issues from Xcode's Issue Navigator.
- Parameters:
tabIdentifier (string, required)
- Returns: Array of issues (errors, warnings, notes) with file paths and line numbers
- Notes: Canonical source for diagnostics. Structured and deduplicated unlike raw build logs.
XcodeRefreshCodeIssuesInFile
Refresh and return live diagnostics for a specific file.
- Parameters:
tabIdentifier (string, required)
path (string, required) — File to refresh diagnostics for
- Returns: Current diagnostics for the specified file
- Notes: Triggers Xcode to re-analyze the file. Useful after editing to check if issues are resolved.
Execution & Rendering
ExecuteSnippet
Run code in a REPL-like environment.
- Parameters:
code (string, required) — Code to execute
language (string, required) — Language identifier (e.g., "swift")
- Returns: Execution result (stdout, stderr, exit code)
- Notes: Sandboxed environment. Treat output as untrusted. Useful for quick validation.
RenderPreview
Render a SwiftUI preview as an image.
- Parameters:
tabIdentifier (string, required)
path (string, required) — File containing the preview
previewIdentifier (string, required) — Name of the preview to render
- Returns: Rendered image data
- Notes: Requires the file to have valid SwiftUI
#Preview or PreviewProvider. Preview must compile successfully.
Search
DocumentationSearch
Search Apple's documentation corpus.
- Parameters:
query (string, required) — Search query
- Returns: Documentation results with titles, summaries, and links. May include WWDC transcript matches.
- Notes: Searches Apple's online documentation and WWDC transcripts. For Xcode-bundled for-LLM guides, use the
axiom-apple-docs skill instead.
Quick Reference by Category
| Category |
Tools |
| Discovery |
XcodeListWindows |
| File Read |
XcodeRead, XcodeGlob, XcodeGrep, XcodeLS |
| File Write |
XcodeWrite, XcodeUpdate, XcodeMakeDir |
| File Destructive |
XcodeRM, XcodeMV |
| Build |
BuildProject, GetBuildLog |
| Test |
RunAllTests, RunSomeTests, GetTestList |
| Diagnostics |
XcodeListNavigatorIssues, XcodeRefreshCodeIssuesInFile |
| Execution |
ExecuteSnippet |
| Preview |
RenderPreview |
| Search |
DocumentationSearch |
Common Parameter Patterns
tabIdentifier — Required by 10/20 tools. Always call XcodeListWindows first.
path — File/directory path. Can be absolute or relative to project root.
patches — Array of { oldText, newText } for XcodeUpdate. Each oldText must be unique in the file.
Resources
Skills: axiom-xcode-mcp-setup, axiom-xcode-mcp-tools
1---2name: axiom-xcode-mcp-ref3description: Reference — all 20 Xcode MCP tools with parameters, return schemas, and examples4license: MIT5---67# Xcode MCP Tool Reference89Complete reference for all 20 tools exposed by Xcode's MCP server (`xcrun mcpbridge`).1011**Important**: Parameter schemas below are sourced from blog research and initial testing. Validate against your live mcpbridge with `tools/list` if behavior differs.1213## Discovery1415### XcodeListWindows1617**Call this first.** Returns open Xcode windows with `tabIdentifier` values needed by most other tools.1819- **Parameters**: None20- **Returns**: List of `{ tabIdentifier: string, workspacePath: string }`21- **Notes**: No parameters needed. If empty, no project is open in Xcode.2223```24XcodeListWindows()25→ { "tabIdentifier": "abc-123", "workspacePath": "/Users/dev/MyApp.xcodeproj" }26```2728---2930## File Operations3132### XcodeRead3334Read file contents from the project.3536- **Parameters**:37 - `path` (string, required) — File path relative to project or absolute38- **Returns**: File contents as string39- **Notes**: Sees Xcode's project view including generated files and resolved SPM packages4041### XcodeWrite4243Create a new file.4445- **Parameters**:46 - `path` (string, required) — File path47 - `content` (string, required) — File contents48- **Returns**: Write confirmation49- **Notes**: Creates the file but does NOT add it to Xcode targets automatically. Use `XcodeUpdate` for existing files.5051### XcodeUpdate5253Edit an existing file with str_replace-style patches.5455- **Parameters**:56 - `path` (string, required) — File path57 - `patches` (array, required) — Array of `{ oldText: string, newText: string }` replacements58- **Returns**: Update confirmation59- **Notes**: Preferred over `XcodeWrite` for editing existing files. Each patch must match exactly one location in the file.6061### XcodeGlob6263Find files matching a pattern.6465- **Parameters**:66 - `pattern` (string, required) — Glob pattern (e.g., `**/*.swift`)67- **Returns**: Array of matching file paths68- **Notes**: Searches within the Xcode project scope6970### XcodeGrep7172Search file contents for a string or pattern.7374- **Parameters**:75 - `query` (string, required) — Search term or pattern76 - `scope` (string, optional) — Limit search to specific directory/file77- **Returns**: Array of matches with file paths and line numbers78- **Notes**: Returns structured results, not raw grep output7980### XcodeLS8182List directory contents.8384- **Parameters**:85 - `path` (string, required) — Directory path86- **Returns**: Array of entries (files and subdirectories)8788### XcodeMakeDir8990Create a directory.9192- **Parameters**:93 - `path` (string, required) — Directory path to create94- **Returns**: Creation confirmation95- **Notes**: Creates intermediate directories as needed9697### XcodeRM9899Delete a file or directory. **DESTRUCTIVE.**100101- **Parameters**:102 - `path` (string, required) — Path to delete103- **Returns**: Deletion confirmation104- **Notes**: Irreversible. Always confirm with the user before calling.105106### XcodeMV107108Move or rename a file. **DESTRUCTIVE.**109110- **Parameters**:111 - `sourcePath` (string, required) — Current path112 - `destinationPath` (string, required) — New path113- **Returns**: Move confirmation114- **Notes**: May break imports and references. Confirm with user. Xcode may not automatically update references.115116---117118## Build & Test119120### BuildProject121122Build the Xcode project.123124- **Parameters**:125 - `tabIdentifier` (string, required) — From `XcodeListWindows`126- **Returns**: `{ buildResult: string, elapsedTime: number, errors: array }`127- **Notes**: Builds the active scheme. Check `buildResult` for "succeeded" or "failed".128129### GetBuildLog130131Retrieve build output after a build.132133- **Parameters**:134 - `tabIdentifier` (string, required)135- **Returns**: Build log as string136- **Notes**: Contains raw compiler output. For structured diagnostics, prefer `XcodeListNavigatorIssues`.137138### RunAllTests139140Run the full test suite.141142- **Parameters**:143 - `tabIdentifier` (string, required)144- **Returns**: Test results with pass/fail counts and failure details145- **Notes**: Runs all tests in the active scheme's test plan. Use `RunSomeTests` for faster iteration.146147### RunSomeTests148149Run specific test(s).150151- **Parameters**:152 - `tabIdentifier` (string, required)153 - `tests` (array of strings, required) — Test identifiers (e.g., `["MyTests/testLogin"]`)154- **Returns**: Test results for the specified tests155- **Notes**: Much faster than `RunAllTests` for iterative debugging. Use test identifiers from `GetTestList`.156157### GetTestList158159List available tests.160161- **Parameters**:162 - `tabIdentifier` (string, required)163- **Returns**: Array of test identifiers organized by test target/class164- **Notes**: Use the returned identifiers with `RunSomeTests`.165166---167168## Diagnostics169170### XcodeListNavigatorIssues171172Get current issues from Xcode's Issue Navigator.173174- **Parameters**:175 - `tabIdentifier` (string, required)176- **Returns**: Array of issues (errors, warnings, notes) with file paths and line numbers177- **Notes**: Canonical source for diagnostics. Structured and deduplicated unlike raw build logs.178179### XcodeRefreshCodeIssuesInFile180181Refresh and return live diagnostics for a specific file.182183- **Parameters**:184 - `tabIdentifier` (string, required)185 - `path` (string, required) — File to refresh diagnostics for186- **Returns**: Current diagnostics for the specified file187- **Notes**: Triggers Xcode to re-analyze the file. Useful after editing to check if issues are resolved.188189---190191## Execution & Rendering192193### ExecuteSnippet194195Run code in a REPL-like environment.196197- **Parameters**:198 - `code` (string, required) — Code to execute199 - `language` (string, required) — Language identifier (e.g., `"swift"`)200- **Returns**: Execution result (stdout, stderr, exit code)201- **Notes**: Sandboxed environment. Treat output as untrusted. Useful for quick validation.202203### RenderPreview204205Render a SwiftUI preview as an image.206207- **Parameters**:208 - `tabIdentifier` (string, required)209 - `path` (string, required) — File containing the preview210 - `previewIdentifier` (string, required) — Name of the preview to render211- **Returns**: Rendered image data212- **Notes**: Requires the file to have valid SwiftUI `#Preview` or `PreviewProvider`. Preview must compile successfully.213214---215216## Search217218### DocumentationSearch219220Search Apple's documentation corpus.221222- **Parameters**:223 - `query` (string, required) — Search query224- **Returns**: Documentation results with titles, summaries, and links. May include WWDC transcript matches.225- **Notes**: Searches Apple's online documentation and WWDC transcripts. For Xcode-bundled for-LLM guides, use the `axiom-apple-docs` skill instead.226227---228229## Quick Reference by Category230231| Category | Tools |232|----------|-------|233| **Discovery** | `XcodeListWindows` |234| **File Read** | `XcodeRead`, `XcodeGlob`, `XcodeGrep`, `XcodeLS` |235| **File Write** | `XcodeWrite`, `XcodeUpdate`, `XcodeMakeDir` |236| **File Destructive** | `XcodeRM`, `XcodeMV` |237| **Build** | `BuildProject`, `GetBuildLog` |238| **Test** | `RunAllTests`, `RunSomeTests`, `GetTestList` |239| **Diagnostics** | `XcodeListNavigatorIssues`, `XcodeRefreshCodeIssuesInFile` |240| **Execution** | `ExecuteSnippet` |241| **Preview** | `RenderPreview` |242| **Search** | `DocumentationSearch` |243244## Common Parameter Patterns245246- **`tabIdentifier`** — Required by 10/20 tools. Always call `XcodeListWindows` first.247- **`path`** — File/directory path. Can be absolute or relative to project root.248- **`patches`** — Array of `{ oldText, newText }` for `XcodeUpdate`. Each oldText must be unique in the file.249250## Resources251252**Skills**: axiom-xcode-mcp-setup, axiom-xcode-mcp-tools