axiom-xcode-mcp-ref
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseXcode MCP Tool Reference
Xcode MCP工具参考文档
Complete reference for all 20 tools exposed by Xcode's MCP server ().
xcrun mcpbridgeImportant: Parameter schemas below are sourced from blog research and initial testing. Validate against your live mcpbridge with if behavior differs.
tools/listXcode MCP服务器()提供的全部20款工具的完整参考文档。
xcrun mcpbridge重要提示:以下参数结构来源于博客研究和初步测试。如果实际行为存在差异,请通过命令在您的实时mcpbridge环境中验证。
tools/listDiscovery
发现类工具
XcodeListWindows
XcodeListWindows
Call this first. Returns open Xcode windows with values needed by most other tools.
tabIdentifier- 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" }请优先调用此工具。返回当前打开的Xcode窗口信息,包含多数其他工具所需的值。
tabIdentifier- 参数:无
- 返回值:类型的列表
{ tabIdentifier: string, workspacePath: string } - 说明:无需参数。若返回结果为空,说明当前Xcode中未打开任何项目。
XcodeListWindows()
→ { "tabIdentifier": "abc-123", "workspacePath": "/Users/dev/MyApp.xcodeproj" }File Operations
文件操作类工具
XcodeRead
XcodeRead
Read file contents from the project.
- Parameters:
- (string, required) — File path relative to project or absolute
path
- Returns: File contents as string
- Notes: Sees Xcode's project view including generated files and resolved SPM packages
读取项目中的文件内容。
- 参数:
- (字符串,必填)—— 文件路径,可相对项目根目录或使用绝对路径
path
- 返回值:文件内容字符串
- 说明:可访问Xcode项目视图中的所有文件,包括生成文件和已解析的SPM包文件
XcodeWrite
XcodeWrite
Create a new file.
- Parameters:
- (string, required) — File path
path - (string, required) — File contents
content
- Returns: Write confirmation
- Notes: Creates the file but does NOT add it to Xcode targets automatically. Use for existing files.
XcodeUpdate
创建新文件。
- 参数:
- (字符串,必填)—— 文件路径
path - (字符串,必填)—— 文件内容
content
- 返回值:写入操作确认信息
- 说明:仅创建文件,不会自动将其添加到Xcode目标中。编辑现有文件请使用。
XcodeUpdate
XcodeUpdate
XcodeUpdate
Edit an existing file with str_replace-style patches.
- Parameters:
- (string, required) — File path
path - (array, required) — Array of
patchesreplacements{ oldText: string, newText: string }
- Returns: Update confirmation
- Notes: Preferred over for editing existing files. Each patch must match exactly one location in the file.
XcodeWrite
通过字符串替换的方式编辑现有文件。
- 参数:
- (字符串,必填)—— 文件路径
path - (数组,必填)—— 包含
patches的替换规则数组{ oldText: string, newText: string }
- 返回值:更新操作确认信息
- 说明:编辑现有文件时优先使用此工具。每个替换规则中的必须在文件中唯一匹配。
oldText
XcodeGlob
XcodeGlob
Find files matching a pattern.
- Parameters:
- (string, required) — Glob pattern (e.g.,
pattern)**/*.swift
- Returns: Array of matching file paths
- Notes: Searches within the Xcode project scope
查找匹配指定模式的文件。
- 参数:
- (字符串,必填)—— Glob模式(例如:
pattern)**/*.swift
- 返回值:匹配文件路径的数组
- 说明:仅在Xcode项目范围内搜索
XcodeGrep
XcodeGrep
Search file contents for a string or pattern.
- Parameters:
- (string, required) — Search term or pattern
query - (string, optional) — Limit search to specific directory/file
scope
- Returns: Array of matches with file paths and line numbers
- Notes: Returns structured results, not raw grep output
在文件内容中搜索指定字符串或模式。
- 参数:
- (字符串,必填)—— 搜索关键词或模式
query - (字符串,可选)—— 限制搜索范围到特定目录或文件
scope
- 返回值:包含文件路径和行号的匹配结果数组
- 说明:返回结构化结果,而非原始grep输出
XcodeLS
XcodeLS
List directory contents.
- Parameters:
- (string, required) — Directory path
path
- Returns: Array of entries (files and subdirectories)
列出目录内容。
- 参数:
- (字符串,必填)—— 目录路径
path
- 返回值:目录项(文件和子目录)的数组
XcodeMakeDir
XcodeMakeDir
Create a directory.
- Parameters:
- (string, required) — Directory path to create
path
- Returns: Creation confirmation
- Notes: Creates intermediate directories as needed
创建目录。
- 参数:
- (字符串,必填)—— 要创建的目录路径
path
- 返回值:创建操作确认信息
- 说明:会自动创建所需的中间目录
XcodeRM
XcodeRM
Delete a file or directory. DESTRUCTIVE.
- Parameters:
- (string, required) — Path to delete
path
- Returns: Deletion confirmation
- Notes: Irreversible. Always confirm with the user before calling.
删除文件或目录。此操作具有破坏性。
- 参数:
- (字符串,必填)—— 要删除的路径
path
- 返回值:删除操作确认信息
- 说明:操作不可逆。调用前务必与用户确认。
XcodeMV
XcodeMV
Move or rename a file. DESTRUCTIVE.
- Parameters:
- (string, required) — Current path
sourcePath - (string, required) — New path
destinationPath
- Returns: Move confirmation
- Notes: May break imports and references. Confirm with user. Xcode may not automatically update references.
移动或重命名文件。此操作具有破坏性。
- 参数:
- (字符串,必填)—— 当前路径
sourcePath - (字符串,必填)—— 新路径
destinationPath
- 返回值:移动操作确认信息
- 说明:可能会破坏导入和引用关系。请与用户确认。Xcode可能不会自动更新相关引用。
Build & Test
构建与测试类工具
BuildProject
BuildProject
Build the Xcode project.
- Parameters:
- (string, required) — From
tabIdentifierXcodeListWindows
- Returns:
{ buildResult: string, elapsedTime: number, errors: array } - Notes: Builds the active scheme. Check for "succeeded" or "failed".
buildResult
构建Xcode项目。
- 参数:
- (字符串,必填)—— 来自
tabIdentifier的返回结果XcodeListWindows
- 返回值:
{ buildResult: string, elapsedTime: number, errors: array } - 说明:构建当前激活的scheme。通过字段查看构建结果为“succeeded”(成功)或“failed”(失败)。
buildResult
GetBuildLog
GetBuildLog
Retrieve build output after a build.
- Parameters:
- (string, required)
tabIdentifier
- Returns: Build log as string
- Notes: Contains raw compiler output. For structured diagnostics, prefer .
XcodeListNavigatorIssues
构建完成后获取构建输出日志。
- 参数:
- (字符串,必填)
tabIdentifier
- 返回值:构建日志字符串
- 说明:包含原始编译器输出。若需要结构化诊断信息,优先使用。
XcodeListNavigatorIssues
RunAllTests
RunAllTests
Run the full test suite.
- Parameters:
- (string, required)
tabIdentifier
- Returns: Test results with pass/fail counts and failure details
- Notes: Runs all tests in the active scheme's test plan. Use for faster iteration.
RunSomeTests
运行完整测试套件。
- 参数:
- (字符串,必填)
tabIdentifier
- 返回值:包含通过/失败计数及失败详情的测试结果
- 说明:运行当前激活scheme测试计划中的所有测试。迭代调试时请使用以提升速度。
RunSomeTests
RunSomeTests
RunSomeTests
Run specific test(s).
- Parameters:
- (string, required)
tabIdentifier - (array of strings, required) — Test identifiers (e.g.,
tests)["MyTests/testLogin"]
- Returns: Test results for the specified tests
- Notes: Much faster than for iterative debugging. Use test identifiers from
RunAllTests.GetTestList
运行指定的测试用例。
- 参数:
- (字符串,必填)
tabIdentifier - (字符串数组,必填)—— 测试用例标识符(例如:
tests)["MyTests/testLogin"]
- 返回值:指定测试用例的测试结果
- 说明:相比速度更快,适合迭代调试。测试用例标识符可从
RunAllTests获取。GetTestList
GetTestList
GetTestList
List available tests.
- Parameters:
- (string, required)
tabIdentifier
- Returns: Array of test identifiers organized by test target/class
- Notes: Use the returned identifiers with .
RunSomeTests
列出可用的测试用例。
- 参数:
- (字符串,必填)
tabIdentifier
- 返回值:按测试目标/类组织的测试用例标识符数组
- 说明:返回的标识符可用于工具。
RunSomeTests
Diagnostics
诊断类工具
XcodeListNavigatorIssues
XcodeListNavigatorIssues
Get current issues from Xcode's Issue Navigator.
- Parameters:
- (string, required)
tabIdentifier
- 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.
获取Xcode问题导航器中的当前问题。
- 参数:
- (字符串,必填)
tabIdentifier
- 返回值:包含错误、警告、提示信息的数组,附带文件路径和行号
- 说明:诊断信息的标准来源。相比原始构建日志,结果结构化且去重。
XcodeRefreshCodeIssuesInFile
XcodeRefreshCodeIssuesInFile
Refresh and return live diagnostics for a specific file.
- Parameters:
- (string, required)
tabIdentifier - (string, required) — File to refresh diagnostics for
path
- Returns: Current diagnostics for the specified file
- Notes: Triggers Xcode to re-analyze the file. Useful after editing to check if issues are resolved.
刷新并返回指定文件的实时诊断信息。
- 参数:
- (字符串,必填)
tabIdentifier - (字符串,必填)—— 要刷新诊断信息的文件
path
- 返回值:指定文件的当前诊断信息
- 说明:会触发Xcode重新分析文件。编辑后检查问题是否解决时非常有用。
Execution & Rendering
执行与渲染类工具
ExecuteSnippet
ExecuteSnippet
Run code in a REPL-like environment.
- Parameters:
- (string, required) — Code to execute
code - (string, required) — Language identifier (e.g.,
language)"swift"
- Returns: Execution result (stdout, stderr, exit code)
- Notes: Sandboxed environment. Treat output as untrusted. Useful for quick validation.
在类REPL环境中运行代码。
- 参数:
- (字符串,必填)—— 要执行的代码
code - (字符串,必填)—— 语言标识符(例如:
language)"swift"
- 返回值:执行结果(标准输出、标准错误、退出码)
- 说明:运行在沙箱环境中。请将输出视为不可信内容。适合快速验证代码。
RenderPreview
RenderPreview
Render a SwiftUI preview as an image.
- Parameters:
- (string, required)
tabIdentifier - (string, required) — File containing the preview
path - (string, required) — Name of the preview to render
previewIdentifier
- Returns: Rendered image data
- Notes: Requires the file to have valid SwiftUI or
#Preview. Preview must compile successfully.PreviewProvider
将SwiftUI预览渲染为图片。
- 参数:
- (字符串,必填)
tabIdentifier - (字符串,必填)—— 包含预览的文件
path - (字符串,必填)—— 要渲染的预览名称
previewIdentifier
- 返回值:渲染后的图片数据
- 说明:要求文件中包含有效的SwiftUI 或
#Preview。预览必须编译成功才能渲染。PreviewProvider
Search
搜索类工具
DocumentationSearch
DocumentationSearch
Search Apple's documentation corpus.
- Parameters:
- (string, required) — Search query
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 skill instead.
axiom-apple-docs
搜索苹果官方文档库。
- 参数:
- (字符串,必填)—— 搜索关键词
query
- 返回值:包含标题、摘要和链接的文档搜索结果,可能包含WWDC文稿匹配结果
- 说明:搜索苹果在线文档和WWDC文稿。若要搜索Xcode内置的LLM指南,请使用技能。
axiom-apple-docs
Quick Reference by Category
按分类快速参考
| Category | Tools |
|---|---|
| Discovery | |
| File Read | |
| File Write | |
| File Destructive | |
| Build | |
| Test | |
| Diagnostics | |
| Execution | |
| Preview | |
| Search | |
| 分类 | 工具 |
|---|---|
| 发现类 | |
| 文件读取类 | |
| 文件写入类 | |
| 文件破坏性操作类 | |
| 构建类 | |
| 测试类 | |
| 诊断类 | |
| 执行类 | |
| 预览类 | |
| 搜索类 | |
Common Parameter Patterns
通用参数模式
- — Required by 10/20 tools. Always call
tabIdentifierfirst.XcodeListWindows - — File/directory path. Can be absolute or relative to project root.
path - — Array of
patchesfor{ oldText, newText }. Each oldText must be unique in the file.XcodeUpdate
- — 20款工具中有10款需要此参数。请始终优先调用
tabIdentifier获取。XcodeListWindows - — 文件/目录路径。可以是绝对路径或相对项目根目录的路径。
path - — 用于
patches的XcodeUpdate数组。每个{ oldText, newText }在文件中必须唯一。oldText
Resources
相关资源
Skills: axiom-xcode-mcp-setup, axiom-xcode-mcp-tools
技能:axiom-xcode-mcp-setup, axiom-xcode-mcp-tools