Inspect Core Data / SwiftData Models
xcode-model-inspectInspect Core Data and SwiftData models directly from Xcode project source files without building or launching a simulator. Extract entities, attributes, relationships, and fetch requests for analysis.
Instructions
xcode-model-inspect
Inspect Core Data .xcdatamodeld packages and SwiftData @Model classes from project source files. Pure file analysis — no simulator, no build required.
What it does
Recursively walks the project path and extracts:
Core Data (.xcdatamodeld)
Reads .xccurrentversion to determine the active model version
Parses entity XML: names, isAbstract, parentEntity, representedClass
Attributes: name, attributeType, optional, defaultValueString
Relationships: name, destinationEntity, toMany, inverseName, optional
Fetch requests: name, predicateString
SwiftData (@Model classes)
Detects @Model-decorated classes via regex
Extracts stored properties (var/let) excluding computed and @Relationship
Extracts @Relationship declarations with toMany detection ([] or Array<>)
Parameters
projectPath (string, optional): Root of Xcode project to inspect (default: '.')
coreDataOnly (boolean, optional): Skip SwiftData scanning
swiftDataOnly (boolean, optional): Skip Core Data scanning
showVersions (boolean, optional): Include all .xcdatamodel version entries with current flagged
raw (string, optional): Dump raw source for a named model (Swift class body or Core Data entity XML)
verbose (boolean, optional): Include per-entity/property breakdown in summary text
Returns
JSON response with:
coreData: array of parsed .xcdatamodeld packages with entities, attributes, and relationshipsswiftData: array of @Model classes with properties and relationshipssummary: compact human-readable summary textnote: present when no models are found (not an error)
structuredContent: { coreDataModels, swiftDataModels, totalEntities }
Examples
Inspect all models
await xcodeModelInspectTool({ projectPath: '/path/to/MyApp' })Core Data only with version history
await xcodeModelInspectTool({ projectPath: '/path/to/MyApp', coreDataOnly: true, showVersions: true })Dump raw source for a specific model
await xcodeModelInspectTool({ projectPath: '/path/to/MyApp', raw: 'Task' })Verbose output
await xcodeModelInspectTool({ projectPath: '/path/to/MyApp', verbose: true })Skipped Directories
node_modules, DerivedData, Pods, Carthage, .git, and any directory starting with '.'
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| raw | No | ||
| verbose | No | ||
| projectPath | No | ||
| coreDataOnly | No | ||
| showVersions | No | ||
| swiftDataOnly | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| totalEntities | Yes | ||
| coreDataModels | Yes | ||
| swiftDataModels | Yes |