dsh-unreal-python-api 1.2.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,57 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.4.0 — 2026-11-30
4
+
5
+ - Two new general tools, so the plugin knows *which* engine it is talking about
6
+ before it answers API questions:
7
+ - `unreal_engine_detect` reports three separate answers — the `.uproject`
8
+ `EngineAssociation`, the resolved installation's `Build.version`, and the
9
+ running editor — plus whether Epic publishes Python API documentation for
10
+ that version. Disagreement is reported as a conflict; no source overwrites
11
+ another.
12
+ - `unreal_project_inspect` returns a read-only inventory: the modules and
13
+ plugins the project declares, the source and `.uplugin` files present on
14
+ disk, and the asset/symbol counts the running editor indexed through
15
+ Monolith. Declared facts and indexed facts are labelled with their
16
+ provenance; without an editor the indexed half is `null` with the
17
+ connection error and nothing is substituted.
18
+ - The editor is reached only through Monolith (`monolithUrl`, default
19
+ `http://127.0.0.1:9316/mcp`) over a read-only allowlist. There is no second
20
+ bridge and no automatic provider fallback: an unreachable editor is an error,
21
+ never a silent empty result.
22
+ - `engines` (a list of installation roots) is read for the version each root
23
+ actually is; a root without a readable `Engine/Build/Build.version` is named in
24
+ the tool's `notes` instead of being dropped.
25
+ - Project inventory understands both Unreal source layouts — one directory per
26
+ module and the flat `Source/<Module>.cpp` form TDA itself uses — and searches
27
+ plugins to depth 6.
28
+ - Fixed a `ReferenceError` in `lib/engine.js` (the editor version parser was
29
+ called under a name the module never imported), which had silently turned a
30
+ reachable editor into an error branch.
31
+
32
+ ## 1.3.0 — 2026-11-30
33
+
34
+ - New `exclude` setting: a list of directories that never get the development
35
+ tier, in **every** `scope` mode. `scope: anywhere` plus `exclude` now means
36
+ "everywhere except these roots", which is how a non-Unreal workspace such as a
37
+ Shopify app stays clean without naming every included project. An exclusion
38
+ also beats `unreal-project` detection and an inclusion list, and it is checked
39
+ without touching the filesystem.
40
+ - Fixed the generated registry import. UE 5.8's `toolset_registry` package
41
+ exports `tool_call`, `tool_raising_exceptions` and `reload_module` — it does
42
+ **not** export a `toolset_registry` object, so `from toolset_registry import
43
+ toolset_registry` failed with `ImportError`. The default is now
44
+ `from toolset_registry import tool_call` with `@tool_call`, and an explicit
45
+ `registry_import` of a module/object still yields the `@<name>.tool_call` form.
46
+ Verified against `Engine/Plugins/Experimental/ToolsetRegistry/Content/Python`.
47
+ - The build notes now say a Python-defined toolset registers as
48
+ `PythonTypes.<ClassName>_<hex>` and how to look the name up.
49
+ - Proven end to end inside a running UE 5.8 editor: the generated toolset
50
+ registered as `PythonTypes.UnrealPythonApiSmokeTools_0x19CC95C7` and
51
+ `unreal.ToolsetRegistry.execute_tool(<name>, 'list_assets',
52
+ '{"folder": "/Game/HOPTRENDY"}')` returned `{"returnValue":[...]}` with 1 370
53
+ asset paths, with `error == ''`.
54
+
3
55
  ## 1.2.0 — 2026-11-30
4
56
 
5
57
  - Split the tools into two tiers. **general** — `unreal_python_tools_list`,
package/README.md CHANGED
@@ -16,6 +16,8 @@ Source: <https://github.com/TaimoorSiddiquiOfficial/dsh-unreal-python-api> · MI
16
16
  | `unreal_python_search` | 66,849 inventory symbols ranked exact → member-name prefix → substring, filterable by kind or parent. |
17
17
  | `unreal_python_syntax` | The exact signature, description, parameter table and return type, read from Epic's published page for that symbol. |
18
18
  | `unreal_python_tool_builder` | Scaffolds a tool from an intent plus verified symbols in four styles: `toolset`, `editor_script`, `mcp_tool`, `dsh_tool`. |
19
+ | `unreal_engine_detect` | Three separate answers — the `.uproject` association, the installation's `Build.version`, the running editor — plus documentation coverage and every conflict between them. |
20
+ | `unreal_project_inspect` | Read-only module, plugin and source inventory, plus the asset/symbol/tag counts the running editor indexed through Monolith, each labelled with its provenance. |
19
21
 
20
22
  A short system-prompt section tells the agent the tools exist, so it reaches for
21
23
  the published API instead of guessing names. Symbols that are not in the inventory
@@ -131,6 +133,9 @@ locale/, icon.svg Host display metadata
131
133
  | `promptSection` | `true` | Register the system-prompt section. |
132
134
  | `scope` | `anywhere` | Where the development tier is offered: `anywhere`, `unreal-project`, or `workspaces`. |
133
135
  | `workspaces` | `[]` | Absolute roots admitted by `scope: workspaces`. |
136
+ | `exclude` | `[]` | Absolute roots that never get the development tier, in every `scope` mode. |
137
+ | `monolithUrl` | `http://127.0.0.1:9316/mcp` | The editor bridge these tools read through. Read-only tools only; there is no fallback provider. |
138
+ | `engines` | `[]` | Installation roots to resolve an `EngineAssociation` against, for a machine whose Launcher manifest is missing or stale. Each root is read for the version it actually is. |
134
139
  | `projectMarkers` | `['.uproject']` | Files that identify a project root; replaces the default list. |
135
140
 
136
141
  ### Two tiers, and workspace scoping
@@ -139,7 +144,7 @@ One profile install serves every workspace, so the tools come in two tiers:
139
144
 
140
145
  | Tier | Tools | Offered |
141
146
  |---|---|---|
142
- | general | `unreal_python_tools_list`, `unreal_python_search`, `unreal_python_syntax` | every workspace, always |
147
+ | general | `unreal_python_tools_list`, `unreal_python_search`, `unreal_python_syntax`, `unreal_engine_detect`, `unreal_project_inspect` | every workspace, always |
143
148
  | development | `unreal_python_tool_builder` | only inside `scope` |
144
149
 
145
150
  `scope` decides where the development tier is admitted:
@@ -150,6 +155,23 @@ One profile install serves every workspace, so the tools come in two tiers:
150
155
  | `unreal-project` | the session's working directory, or a parent, holds a `*.uproject` |
151
156
  | `workspaces` | the working directory is inside one of the `workspaces` roots |
152
157
 
158
+ `exclude` wins over `scope` in every mode, so the usual setup for one Unreal
159
+ project among non-Unreal workspaces is to leave `scope: anywhere` and name the
160
+ worktrees to skip:
161
+
162
+ ```yaml
163
+ - id: unreal-python-api
164
+ name: 'dsh-unreal-python-api'
165
+ config:
166
+ exclude:
167
+ - D:\HOPRELAY
168
+ - D:\ShopifyApp
169
+ ```
170
+
171
+ An exclusion is a path check with no filesystem access, so it also settles the
172
+ "this project has no `.uproject` yet" case that `scope: unreal-project` cannot
173
+ judge.
174
+
153
175
  ```yaml
154
176
  # the dsh-unreal-python-api row's config (profile cordis.patch.yml, or the
155
177
  # plugin's settings panel in the GUI when it offers one)
@@ -167,6 +189,30 @@ scope the development tool is absent from the model's tool list entirely rather
167
189
  than refused at call time, and the prompt section says so. The general tier is
168
190
  never gated, so documentation lookups keep working in every workspace.
169
191
 
192
+ ### Which engine, and which project
193
+
194
+ Documentation answers and runtime facts are different things, so they are never
195
+ merged:
196
+
197
+ | Question | Answered by | When it is unavailable |
198
+ |---|---|---|
199
+ | What does the project file ask for? | `EngineAssociation` in the `.uproject` | the file declares none |
200
+ | What is actually installed? | that installation's `Engine/Build/Build.version` | no installation resolves for the association |
201
+ | What is running right now? | the editor, through Monolith | the editor is not running, or the port is not answering |
202
+
203
+ All three are reported separately, and a disagreement becomes a `conflicts` entry
204
+ instead of one value quietly replacing another. Documentation coverage follows the
205
+ *editor/build* version: a project whose only documentation is 5.8 returns
206
+ `unavailable_for_version` rather than borrowing the 5.8 inventory.
207
+
208
+ `unreal_project_inspect` keeps declared facts (`.uproject`, `Source/`, `Plugins/`)
209
+ apart from indexed facts (asset, symbol and tag counts from the editor's index) and
210
+ labels both with their provenance. When the editor is unreachable the indexed half
211
+ is `null` together with the connection error — never zero, never a guess. Both
212
+ tools are read-only: the Monolith client carries an allowlist, so a mutating
213
+ action cannot be issued through it, and a broken connection is reported rather than
214
+ retried against another provider.
215
+
170
216
  ## Publishing to the market
171
217
 
172
218
  The market catalog is curated through
package/docs/DETAIL.md CHANGED
@@ -46,7 +46,7 @@ returned with `resolved: false` and a note instead of a guess.
46
46
  **`unreal_python_tool_builder`** — scaffolds an Unreal Python tool from a
47
47
  description and a list of API symbols per tool. It emits either a ToolsetRegistry
48
48
  toolset class (`@unreal.uclass()` on `unreal.ToolsetDefinition`,
49
- `@toolset_registry.tool_call` static methods with annotated parameters,
49
+ `@tool_call` static methods with annotated parameters,
50
50
  docstring, registration and unregistration functions) or a plain editor script,
51
51
  plus a test module skeleton. Each requested symbol is verified against the
52
52
  inventory: verified ones are recorded beside the tool body with their
@@ -68,6 +68,7 @@ grounded starting point, not finished code.
68
68
  | `promptSection` | `true` | Adds one line to the system prompt naming the tools and the documentation root. |
69
69
  | `scope` | `anywhere` | `anywhere`, `unreal-project`, or `workspaces`; where the development tier is admitted. |
70
70
  | `workspaces` | `[]` | Absolute roots admitted by `scope: workspaces`; required by that mode. |
71
+ | `exclude` | `[]` | Absolute roots that never get the development tier, in every `scope` mode. Checked before anything else and with no filesystem access. |
71
72
  | `projectMarkers` | `['.uproject']` | File names (or `.extension` suffixes) that mark a project root. Replaces, never extends, the default. |
72
73
 
73
74
  ### Scope gate
package/index.js CHANGED
@@ -23,6 +23,9 @@ import {
23
23
  } from './lib/inventory.js'
24
24
  import { readSymbolDoc } from './lib/docs.js'
25
25
  import { DEFAULT_REGISTRY_IMPORT, buildToolset } from './lib/builder.js'
26
+ import { detectEngine, readBuildVersion } from './lib/engine.js'
27
+ import { DEFAULT_MONOLITH_URL, createMonolithClient } from './lib/monolith.js'
28
+ import { inspectProject } from './lib/project.js'
26
29
  import {
27
30
  DEFAULT_PROJECT_MARKERS,
28
31
  DEFAULT_SCOPE,
@@ -45,6 +48,9 @@ export const Config = z.object({
45
48
  scope: z.string().default(DEFAULT_SCOPE),
46
49
  workspaces: z.array(z.string()).default([]),
47
50
  projectMarkers: z.array(z.string()).default(DEFAULT_PROJECT_MARKERS),
51
+ exclude: z.array(z.string()).default([]),
52
+ monolithUrl: z.string().default(DEFAULT_MONOLITH_URL),
53
+ engines: z.array(z.string()).default([]),
48
54
  })
49
55
 
50
56
  /** Largest row count any tool returns, whatever a caller asks for. */
@@ -110,6 +116,11 @@ function countSchema() {
110
116
  }
111
117
  }
112
118
 
119
+ /** A string that may be absent in the source data. @returns {object} Value spec. */
120
+ function nullableString() {
121
+ return { oneOf: [{ type: 'string' }, { type: 'null' }] }
122
+ }
123
+
113
124
  /**
114
125
  * Render symbol rows as compact lines.
115
126
  * @param {string} header First line.
@@ -140,11 +151,32 @@ export function apply(ctx, config) {
140
151
  if (!Number.isFinite(maxResults) || maxResults < 1) throw new Error('maxResults must be a positive number')
141
152
  if (!Number.isFinite(fetchTimeoutMs) || fetchTimeoutMs < 1_000) throw new Error('fetchTimeoutMs must be at least 1000')
142
153
  if (!Number.isFinite(refreshHours) || refreshHours < 0) throw new Error('refreshHours must not be negative')
154
+ const monolithUrl = String(config.monolithUrl ?? DEFAULT_MONOLITH_URL)
155
+ if (!/^https?:\/\//.test(monolithUrl)) throw new Error('monolithUrl must be an http(s) URL')
156
+ // `engines` is configured as a list of installation roots. resolveInstallation
157
+ // keys installations by the EngineAssociation they answer for, so each root is
158
+ // read for the version it actually is. A root without a readable
159
+ // Engine/Build/Build.version is reported in the tool output, not dropped quietly.
160
+ /** @type {Record<string, string>} */
161
+ const engines = {}
162
+ /** @type {string[]} */
163
+ const engineNotes = []
164
+ for (const entry of Array.isArray(config.engines) ? config.engines : []) {
165
+ if (typeof entry !== 'string' || entry.trim() === '') continue
166
+ const enginePath = entry.trim()
167
+ const build = readBuildVersion(enginePath)
168
+ if (build !== null && build.version !== null) {
169
+ engines[build.version] = enginePath
170
+ continue
171
+ }
172
+ engineNotes.push(`configured engine ${enginePath} has no readable Engine/Build/Build.version and was ignored`)
173
+ }
143
174
 
144
175
  const scope = resolveScope({
145
176
  scope: config.scope,
146
177
  workspaces: config.workspaces,
147
178
  projectMarkers: config.projectMarkers,
179
+ exclude: config.exclude,
148
180
  })
149
181
  const gate = createScopeGate({
150
182
  resolved: scope,
@@ -166,6 +198,37 @@ export function apply(ctx, config) {
166
198
  ? registerGeneral
167
199
  : (definition) => ctx.tools.register(definition, { when: (context) => gate.admits(context.agent) })
168
200
 
201
+ // The editor is reached only through Monolith's read-only tools. No second
202
+ // bridge, and no provider fallback: when Monolith is unreachable the caller
203
+ // gets the connection error instead of an empty result.
204
+ const monolith = createMonolithClient({
205
+ url: monolithUrl,
206
+ timeoutMs: Math.min(fetchTimeoutMs, 15_000),
207
+ clientName: 'dsh-unreal-python-api',
208
+ })
209
+
210
+ /**
211
+ * Resolve the project directory: an explicit argument, otherwise the agent's
212
+ * current workspace. Nothing is guessed.
213
+ * @param {{ directory?: unknown }} args Validated tool arguments.
214
+ * @param {{ agent?: { session?: unknown } } | undefined} exec Tool execution context.
215
+ * @returns {string} Absolute project directory.
216
+ */
217
+ function projectDirectory(args, exec) {
218
+ const requested = typeof args.directory === 'string' ? args.directory.trim() : ''
219
+ if (requested !== '') return requested
220
+ try {
221
+ const session = exec?.agent?.session
222
+ if (session !== undefined) {
223
+ const current = ctx.workingDirectory.get(session)
224
+ if (typeof current === 'string' && current !== '') return current
225
+ }
226
+ } catch {
227
+ // fall through to the explicit error below
228
+ }
229
+ throw new Error('directory is required: pass the project directory, or run this tool inside a workspace')
230
+ }
231
+
169
232
  let loaded = null
170
233
  /**
171
234
  * Load the inventory once per process, re-reading it when a caller asks to refresh.
@@ -528,14 +591,336 @@ export function apply(ctx, config) {
528
591
  },
529
592
  }))
530
593
 
594
+ registerGeneral(defineTool({
595
+ name: 'unreal_engine_detect',
596
+ description: 'Report which Unreal Engine version a project uses, from three independent sources: the .uproject EngineAssociation, the resolved installation Build.version, and the running editor reached through Monolith. Also reports whether Epic publishes Python API documentation for that version. Disagreements are reported as conflicts, never resolved by letting one source overwrite another.',
597
+ parameters: {
598
+ directory: { type: 'string', description: 'Project directory; defaults to the current workspace.' },
599
+ },
600
+ output: {
601
+ schema: {
602
+ type: 'object',
603
+ additionalProperties: false,
604
+ properties: {
605
+ directory: { type: 'string', required: true },
606
+ engineAssociation: nullableString(),
607
+ installation: {
608
+ oneOf: [
609
+ { type: 'null' },
610
+ {
611
+ type: 'object',
612
+ additionalProperties: false,
613
+ properties: {
614
+ version: nullableString(),
615
+ path: nullableString(),
616
+ source: nullableString(),
617
+ buildVersion: nullableString(),
618
+ changelist: { oneOf: [{ type: 'number' }, { type: 'null' }] },
619
+ branch: nullableString(),
620
+ },
621
+ },
622
+ ],
623
+ },
624
+ editor: {
625
+ type: 'object',
626
+ additionalProperties: false,
627
+ properties: {
628
+ connected: { type: 'boolean', required: true },
629
+ version: nullableString(),
630
+ projectName: nullableString(),
631
+ serverVersion: nullableString(),
632
+ port: { oneOf: [{ type: 'number' }, { type: 'null' }] },
633
+ actions: { oneOf: [{ type: 'number' }, { type: 'null' }] },
634
+ error: {
635
+ type: 'object',
636
+ additionalProperties: false,
637
+ properties: {
638
+ code: { type: 'string', required: true },
639
+ message: { type: 'string', required: true },
640
+ },
641
+ },
642
+ },
643
+ },
644
+ documentation: {
645
+ type: 'object',
646
+ additionalProperties: false,
647
+ properties: {
648
+ status: { type: 'string', required: true },
649
+ version: nullableString(),
650
+ documentedVersions: { type: 'array', items: { type: 'string' } },
651
+ url: { type: 'string' },
652
+ note: { type: 'string' },
653
+ },
654
+ },
655
+ conflicts: { type: 'array', required: true, items: { type: 'string' } },
656
+ notes: { type: 'array', required: true, items: { type: 'string' } },
657
+ verified: {
658
+ type: 'object',
659
+ additionalProperties: false,
660
+ properties: {
661
+ fromProjectFile: { type: 'boolean', required: true },
662
+ fromInstallation: { type: 'boolean', required: true },
663
+ fromEditor: { type: 'boolean', required: true },
664
+ },
665
+ },
666
+ },
667
+ },
668
+ render: (_args, value) => {
669
+ const lines = [`Unreal Engine detection for ${value.directory}`]
670
+ lines.push(` project association : ${value.engineAssociation ?? 'not declared'}`)
671
+ const installation = value.installation
672
+ if (installation === null) {
673
+ lines.push(' installation : no installation resolved for this association')
674
+ } else {
675
+ lines.push(` installation : ${installation.version ?? 'unknown'} at ${installation.path ?? 'unknown path'} (${installation.source ?? 'unknown source'})`)
676
+ if (installation.buildVersion !== null) {
677
+ const changelist = installation.changelist === null ? '' : ` CL-${installation.changelist}`
678
+ lines.push(` Build.version : ${installation.buildVersion}${installation.branch === null ? '' : ` ${installation.branch}`}${changelist}`)
679
+ }
680
+ }
681
+ if (value.editor.connected) {
682
+ lines.push(` running editor : ${value.editor.version ?? 'unknown version'} for ${value.editor.projectName ?? 'unknown project'} (monolith ${value.editor.serverVersion ?? '?'}, ${value.editor.actions ?? '?'} actions)`)
683
+ } else {
684
+ lines.push(` running editor : unreachable (${value.editor.error?.code ?? 'error'}: ${value.editor.error?.message ?? ''})`)
685
+ }
686
+ lines.push(` documentation : ${value.documentation.status}${value.documentation.note === undefined ? '' : ` — ${value.documentation.note}`}`)
687
+ if (value.conflicts.length > 0) {
688
+ lines.push(' conflicts:')
689
+ for (const conflict of value.conflicts) lines.push(` ${conflict}`)
690
+ }
691
+ if (value.notes.length > 0) {
692
+ lines.push(' notes:')
693
+ for (const note of value.notes) lines.push(` ${note}`)
694
+ }
695
+ return [{ type: 'text', text: lines.join('\n') }]
696
+ },
697
+ },
698
+ timeoutMs: 20_000,
699
+ async execute(args, exec) {
700
+ const directory = projectDirectory(args, exec)
701
+ const result = await detectEngine({ directory, engines, docBaseUrl, client: monolith })
702
+ const installation = result.installation
703
+ const build = installation?.build ?? null
704
+ return {
705
+ directory,
706
+ engineAssociation: result.project?.engineAssociation ?? null,
707
+ installation:
708
+ installation === null || installation === undefined
709
+ ? null
710
+ : {
711
+ version: installation.version ?? null,
712
+ path: installation.path ?? null,
713
+ source: installation.source ?? null,
714
+ buildVersion: build?.version ?? null,
715
+ changelist: typeof build?.changelist === 'number' ? build.changelist : null,
716
+ branch: build?.branch ?? null,
717
+ },
718
+ editor: {
719
+ connected: result.editor.connected,
720
+ version: result.editor.version ?? null,
721
+ projectName: result.editor.projectName ?? null,
722
+ serverVersion: result.editor.serverVersion ?? null,
723
+ port: result.editor.port ?? null,
724
+ actions: result.editor.actions ?? null,
725
+ ...(result.editor.error === null || result.editor.error === undefined ? {} : { error: result.editor.error }),
726
+ },
727
+ documentation: {
728
+ status: result.documentation.status,
729
+ version: result.documentation.version ?? null,
730
+ documentedVersions: result.documentation.documentedVersions ?? [],
731
+ url: result.documentation.url ?? docBaseUrl,
732
+ note: result.documentation.note ?? '',
733
+ },
734
+ conflicts: result.conflicts,
735
+ notes: engineNotes,
736
+ verified: result.verified,
737
+ }
738
+ },
739
+ }))
740
+
741
+ registerGeneral(defineTool({
742
+ name: 'unreal_project_inspect',
743
+ description: 'Read-only inventory of an Unreal project: the modules and plugins the .uproject declares, the source and plugin files present on disk, and the asset/symbol counts the running editor has indexed through Monolith. Declared facts and indexed facts are labelled separately; when the editor is unreachable the indexed half is null with the connection error, and nothing is substituted for it. This tool never mutates the project.',
744
+ parameters: {
745
+ directory: { type: 'string', description: 'Project directory; defaults to the current workspace.' },
746
+ },
747
+ output: {
748
+ schema: {
749
+ type: 'object',
750
+ additionalProperties: false,
751
+ properties: {
752
+ directory: { type: 'string', required: true },
753
+ project: {
754
+ type: 'object',
755
+ additionalProperties: false,
756
+ properties: {
757
+ file: { type: 'string', required: true },
758
+ name: { type: 'string', required: true },
759
+ engineAssociation: nullableString(),
760
+ description: { type: 'string' },
761
+ modules: {
762
+ type: 'array',
763
+ required: true,
764
+ items: {
765
+ type: 'object',
766
+ additionalProperties: false,
767
+ properties: {
768
+ name: { type: 'string', required: true },
769
+ type: nullableString(),
770
+ loadingPhase: nullableString(),
771
+ sourceDirectory: nullableString(),
772
+ sourceLayout: nullableString(),
773
+ sourceFiles: { type: 'number', required: true },
774
+ sourceFilesTruncated: { type: 'boolean', required: true },
775
+ },
776
+ },
777
+ },
778
+ },
779
+ },
780
+ plugins: {
781
+ type: 'object',
782
+ additionalProperties: false,
783
+ properties: {
784
+ declared: {
785
+ type: 'array',
786
+ required: true,
787
+ items: {
788
+ type: 'object',
789
+ additionalProperties: false,
790
+ properties: {
791
+ name: { type: 'string', required: true },
792
+ enabled: { type: 'boolean', required: true },
793
+ },
794
+ },
795
+ },
796
+ onDisk: {
797
+ type: 'object',
798
+ additionalProperties: false,
799
+ properties: {
800
+ count: { type: 'number', required: true },
801
+ truncated: { type: 'boolean', required: true },
802
+ unlisted: { type: 'array', required: true, items: { type: 'string' } },
803
+ },
804
+ },
805
+ },
806
+ },
807
+ editor: {
808
+ type: 'object',
809
+ additionalProperties: false,
810
+ properties: {
811
+ connected: { type: 'boolean', required: true },
812
+ projectName: nullableString(),
813
+ engineVersion: nullableString(),
814
+ serverVersion: nullableString(),
815
+ actions: { oneOf: [{ type: 'number' }, { type: 'null' }] },
816
+ error: {
817
+ type: 'object',
818
+ additionalProperties: false,
819
+ properties: {
820
+ code: { type: 'string', required: true },
821
+ message: { type: 'string', required: true },
822
+ },
823
+ },
824
+ },
825
+ },
826
+ counts: {
827
+ type: 'array',
828
+ required: true,
829
+ items: {
830
+ type: 'object',
831
+ additionalProperties: false,
832
+ properties: {
833
+ name: { type: 'string', required: true },
834
+ value: { type: 'number', required: true },
835
+ },
836
+ },
837
+ },
838
+ indexHealth: {
839
+ oneOf: [
840
+ { type: 'null' },
841
+ {
842
+ type: 'object',
843
+ additionalProperties: false,
844
+ properties: {
845
+ state: { type: 'string', required: true },
846
+ detail: { type: 'string', required: true },
847
+ },
848
+ },
849
+ ],
850
+ },
851
+ provenance: {
852
+ type: 'object',
853
+ additionalProperties: false,
854
+ properties: {
855
+ modules: { type: 'string', required: true },
856
+ plugins: { type: 'string', required: true },
857
+ contentCounts: { type: 'string' },
858
+ editor: { type: 'string' },
859
+ },
860
+ },
861
+ readOnly: { type: 'boolean', required: true },
862
+ },
863
+ },
864
+ render: (_args, value) => {
865
+ const lines = [`${value.project.name} (${value.project.file})`]
866
+ lines.push(` engine association : ${value.project.engineAssociation ?? 'not declared'}`)
867
+ const modules = value.project.modules
868
+ .map((module) => `${module.name}${module.type === null ? '' : ` [${module.type}]`}${module.sourceFiles === 0 ? ' (no source files)' : ` (${module.sourceFiles}${module.sourceFilesTruncated ? '+' : ''} source files)`}`)
869
+ .join(', ')
870
+ lines.push(` modules : ${modules === '' ? 'none declared' : modules}`)
871
+ lines.push(` plugins declared : ${value.plugins.declared.length}`)
872
+ lines.push(` plugins on disk : ${value.plugins.onDisk.count}${value.plugins.onDisk.truncated ? '+' : ''}${value.plugins.onDisk.unlisted.length === 0 ? '' : `, ${value.plugins.onDisk.unlisted.length} not declared in the .uproject`}`)
873
+ if (value.editor.connected) {
874
+ lines.push(` editor : ${value.editor.projectName ?? 'unknown project'} on ${value.editor.engineVersion ?? 'unknown engine'} (monolith ${value.editor.serverVersion ?? '?'}, ${value.editor.actions ?? '?'} actions)`)
875
+ lines.push(` indexed counts : ${value.counts.map((entry) => `${entry.name} ${entry.value}`).join(', ')}`)
876
+ if (value.indexHealth !== null) {
877
+ lines.push(` index health : ${value.indexHealth.state}${value.indexHealth.detail === '' ? '' : ` — ${value.indexHealth.detail}`}`)
878
+ }
879
+ } else {
880
+ lines.push(` editor : unreachable (${value.editor.error?.code ?? 'error'}: ${value.editor.error?.message ?? ''})`)
881
+ lines.push(' indexed counts : unavailable, the editor is not reachable; no substitute values are reported')
882
+ }
883
+ lines.push(` provenance : modules ${value.provenance.modules}; plugins ${value.provenance.plugins}${value.provenance.contentCounts === undefined ? '' : `; counts ${value.provenance.contentCounts}`}`)
884
+ return [{ type: 'text', text: lines.join('\n') }]
885
+ },
886
+ },
887
+ timeoutMs: 20_000,
888
+ async execute(args, exec) {
889
+ const directory = projectDirectory(args, exec)
890
+ const result = await inspectProject({ directory, client: monolith })
891
+ const counts =
892
+ result.index === null
893
+ ? []
894
+ : Object.entries(result.index)
895
+ .filter(([, value]) => typeof value === 'number')
896
+ .map(([name, value]) => ({ name, value }))
897
+ return {
898
+ directory: result.directory,
899
+ project: {
900
+ file: result.project.file,
901
+ name: result.project.name,
902
+ engineAssociation: result.project.engineAssociation,
903
+ description: result.project.description,
904
+ modules: result.project.modules,
905
+ },
906
+ plugins: result.plugins,
907
+ editor: result.editor,
908
+ counts,
909
+ indexHealth: result.indexHealth,
910
+ provenance: result.provenance,
911
+ readOnly: true,
912
+ }
913
+ },
914
+ }))
915
+
531
916
  if (config.promptSection) {
532
917
  ctx.systemPrompt.section({
533
918
  name: 'plugin:unreal-python-api',
534
919
  order: 350,
535
920
  text:
536
921
  scope.scope === 'anywhere'
537
- ? `Unreal Python API (published 5.8 documentation): unreal_python_tools_list and unreal_python_search find documented symbols, unreal_python_syntax returns their exact signatures and parameters, and unreal_python_tool_builder scaffolds a tool from verified symbols in one of four styles — a ToolsetRegistry toolset, an editor script, MCP tool descriptors with their Python handlers, or a DSH tool module built on defineTool. Documentation root: ${docBaseUrl}`
538
- : `Unreal Python API (published 5.8 documentation): unreal_python_tools_list, unreal_python_search and unreal_python_syntax are available here; unreal_python_tool_builder is admitted only inside ${describeScope(scope)}, so it is absent when you work elsewhere. Documentation root: ${docBaseUrl}`,
922
+ ? `Unreal Python API (published 5.8 documentation): unreal_python_tools_list and unreal_python_search find documented symbols, unreal_python_syntax returns their exact signatures and parameters, unreal_python_tool_builder scaffolds a tool from verified symbols in one of four styles — a ToolsetRegistry toolset, an editor script, MCP tool descriptors with their Python handlers, or a DSH tool module built on defineTool, unreal_engine_detect reports the project, installation and running-editor versions separately with any conflict, and unreal_project_inspect returns a read-only module, plugin and indexed-asset inventory through Monolith. Documentation root: ${docBaseUrl}`
923
+ : `Unreal Python API (published 5.8 documentation): unreal_python_tools_list, unreal_python_search, unreal_python_syntax, unreal_engine_detect and unreal_project_inspect are available here; unreal_python_tool_builder is admitted only inside ${describeScope(scope)}, so it is absent when you work elsewhere. Documentation root: ${docBaseUrl}`,
539
924
  })
540
925
  }
541
926
  }