Skip to content

feat(inspect): add inspect_cdo sub-action for Blueprint CDO inspection#329

Merged
ChiR24 merged 4 commits intoChiR24:mainfrom
6r0m:feat/inspect-cdo
Apr 3, 2026
Merged

feat(inspect): add inspect_cdo sub-action for Blueprint CDO inspection#329
ChiR24 merged 4 commits intoChiR24:mainfrom
6r0m:feat/inspect-cdo

Conversation

@6r0m
Copy link
Copy Markdown
Contributor

@6r0m 6r0m commented Apr 2, 2026

Summary

Add inspect_cdo action to the inspect tool. Inspect any Blueprint's
Class Default Object without spawning an actor. Reads CDO property values
via reflection; for Actor BPs enumerates all components (native from CDO
with effective overrides, BP-added from SCS templates with full parent chain).

Changes

  • Add inspect_cdo to inspect action enum with blueprintPath, detailed, propertyNames inputs
  • Add HandleInspectCdoAction in PropertyHandlers.cpp with thin dispatcher in EnvironmentHandlers.cpp
  • Add BuildComponentSummary, BuildScsSourceMap, FindCdoComponent helpers
  • Add objectPath fallback in TS handler, output schema fields for all response branches
  • Add 6 Vitest unit tests (routing, params, schema enum)
  • Update handler-mapping.md, editor-plugin-extension.md, CHANGELOG

Related Issues

None

Type of Change

  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Test addition/update

Testing

  • Tested with Unreal Engine (version: 5.7)
  • Tested MCP client integration (client: VS Code / Claude)
  • Added/updated tests

Pre-Merge Checklist

  • Code follows project style guidelines
  • Self-reviewed the code
  • Updated relevant documentation (if needed)
  • Added/updated tests (if applicable)
  • CI passes

Open with Devin

6r0m and others added 3 commits April 2, 2026 23:49
Inspect any Blueprint's Class Default Object (CDO) without spawning
actors via reflection. For Actor BPs, enumerate CDO components with
effective overrides (SCS/SCS_Inherited/Native), including key fields
(mesh, animClass, transform). Supports detailed/componentName/propertyNames
filters.

Updated CHANGELOG.md, editor-plugin-extension.md, handler-mapping.md.
Added routing in EnvironmentHandlers.cpp to HandleInspectCdoAction.
- Wrap `inspect_cdo` implementation in `#if WITH_EDITOR` to ensure runtime
  safety (reflection on CDO/components).
- Update CHANGELOG.md and code comments to describe "inferred source"
  classification via CDO component name matching against SCS variables
  (assumes standard UE 5.0-5.7 Blueprint compilation).
- Simplify `LoadBlueprintAsset` call (direct function).
- Add `#include "Animation/AnimInstance.h"`.
…on for agents

- Read native components from CDO (effective overrides), SCS components
  from node templates (BP-added, full parent chain)
- Add attachParent from SCS node tree for BP-added components
- Fix LoadBlueprintAsset call (free function, not namespaced)
- Add Animation/AnimInstance.h for UE 5.7 build compatibility
- Add inspect_cdo to tool description so agents discover it
- Soften source classification claim to "inferred"

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 2, 2026

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added inspect_cdo to the inspect tool: inspect Blueprint Class Default Objects with component enumeration and configurable property/detail filters.
  • Documentation

    • Updated docs and handler mappings to describe the new inspect_cdo action and its behavior.
  • Tooling

    • Expanded inspect tool schema and added dedicated handler routing for inspect_cdo.
  • Tests

    • Added unit tests covering inspect_cdo request payloads, fallbacks, and error paths.

Walkthrough

Adds an inspect_cdo sub-action to the inspect tool to reflectively inspect Blueprint Class Default Objects (CDOs) without spawning actors, including component enumeration across native CDO and Blueprint SCS templates, source classification, and configurable property output.

Changes

Cohort / File(s) Summary
Docs / Changelog
CHANGELOG.md, docs/editor-plugin-extension.md, docs/handler-mapping.md
Documented new inspect_cdo action and its handler mapping/behavior; updated handler mapping table and editor-plugin action list.
C++: Environment Dispatcher
plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_EnvironmentHandlers.cpp
Treat inspect_cdo as a global action and dispatch to the new CDO handler path in-place of object-specific inspection.
C++: Property Handlers
plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_PropertyHandlers.cpp
New editor-only HandleInspectCdoAction and helpers: load Blueprint, extract CDO, enumerate native CDO + SCS components (with source/attachParent), support componentName/detailed/propertyNames filtering and property export.
C++ Header
plugins/McpAutomationBridge/Source/McpAutomationBridge/Public/McpAutomationBridgeSubsystem.h
Added private declaration for HandleInspectCdoAction.
TypeScript: Tool Definition
src/tools/consolidated-tool-definitions.ts
Extended inspect tool: added inspect_cdo action, input props blueprintPath/detailed/propertyNames, and richer output schema (cdoProperties, components, class fields, etc.).
TypeScript: Handlers & Types
src/tools/handlers/inspect-handlers.ts, src/types/handler-types.ts
Added inspect_cdo branch in handler dispatcher and added blueprintPath, detailed, propertyNames to InspectArgs.
Tests
tests/unit/tools/inspect_handlers.test.ts
New unit tests validating inspect_cdo request payload construction, fallback from objectPath, optional params forwarding, and failure passthrough.

Sequence Diagram

sequenceDiagram
    actor Client
    participant TS as TS Handler
    participant Bridge as C++ Bridge (Subsystem)
    participant Engine as Unreal Engine

    Client->>TS: inspect_cdo(blueprintPath, options)
    TS->>TS: build automation request
    TS->>Bridge: executeAutomationRequest(action: "inspect_cdo", blueprintPath, ...)
    
    Bridge->>Bridge: HandleInspectAction (classify global)
    Bridge->>Bridge: Dispatch -> HandleInspectCdoAction

    Bridge->>Engine: Load Blueprint asset (blueprintPath)
    Engine-->>Bridge: Blueprint / GeneratedClass

    Bridge->>Engine: Get Class Default Object (CDO)
    Engine-->>Bridge: CDO

    alt single component requested
        Bridge->>Engine: Resolve component by name (native CDO -> SCS)
        Engine-->>Bridge: Component template
        Bridge->>Bridge: Export filtered properties
    else enumerate all components
        Bridge->>Engine: Enumerate native CDO components
        Engine-->>Bridge: native list
        Bridge->>Engine: Traverse Blueprint parents -> collect SCS templates
        Engine-->>Bridge: SCS components with attachParent/source
        Bridge->>Bridge: Merge/deduplicate -> build components array
        Bridge->>Bridge: Optionally export cdoProperties / detailed properties
    end

    Bridge->>TS: Return JSON result (class, cdoProperties?, components)
    TS->>Client: Cleaned inspection result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

area/tools, size/m

Suggested reviewers

  • ChiR24

Poem

🐰
I hopped to a Blueprint, quiet and slow,
Peeked at the CDO where its secrets grow.
No actor summoned, just reflection's light—
Components lined up, properties in sight.
A carrot for code, and a joyous bite! 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 55.56% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding an inspect_cdo sub-action for Blueprint CDO inspection, which aligns with the primary purpose of this pull request.
Description check ✅ Passed The description covers all required template sections: Summary explains the feature clearly, Changes lists key implementation details, Type of Change is marked appropriately, Testing documents validation with UE 5.7 and MCP clients, and Pre-Merge Checklist is fully completed.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai bot added the enhancement New feature or request label Apr 2, 2026
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 5 additional findings.

Open in Devin Review

coderabbitai[bot]

This comment was marked as resolved.

…load construction

- Guard against null Payload before dereferencing in HandleInspectCdoAction
- Put action after spread to prevent normalizedArgs.action override
- Use normalizedArgs.objectPath (alias-normalized) for blueprintPath fallback

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
src/tools/handlers/inspect-handlers.ts (1)

686-692: ⚠️ Potential issue | 🟠 Major

Normalize and pre-validate blueprintPath before dispatch

Line 691 still sends an unnormalized/raw value (and may pass an empty value), and Line 688 omits tool/action error context. This can fail at the C++ boundary with less actionable diagnostics.

Proposed fix
-import { normalizeArgs, resolveObjectPath, extractString, extractOptionalString } from './argument-helper.js';
+import { normalizeArgs, resolveObjectPath, extractString, extractOptionalString } from './argument-helper.js';
+import { normalizePath } from '../../utils/normalize.js';
...
     case 'inspect_cdo': {
-      const inspectArgs = args as InspectArgs;
-      const res = await executeAutomationRequest(tools, 'inspect', {
+      const inspectArgs = normalizedArgs as InspectArgs;
+      const blueprintPathRaw = inspectArgs.blueprintPath ?? inspectArgs.objectPath;
+      const blueprintPath = typeof blueprintPathRaw === 'string' ? normalizePath(blueprintPathRaw) : '';
+      if (!blueprintPath) {
+        throw new Error('inspect:inspect_cdo - blueprintPath is required');
+      }
+
+      const res = await executeAutomationRequest(tools, 'inspect', {
         ...normalizedArgs,
         action: 'inspect_cdo',
-        blueprintPath: inspectArgs.blueprintPath || normalizedArgs.objectPath as string,
-      });
+        blueprintPath,
+      }, 'inspect:inspect_cdo - automation bridge not available');
       return cleanObject(res) as Record<string, unknown>;
     }

As per coding guidelines: "Validate action using requireAction(args) and normalize paths using normalizePath() before sending parameters to the C++ bridge" and "Include tool and action names in all error messages for proper error context".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/tools/handlers/inspect-handlers.ts` around lines 686 - 692, In the
'inspect_cdo' case, validate the requested action with requireAction(args) and
normalize/pre-validate blueprintPath from InspectArgs before calling
executeAutomationRequest: call normalizePath(...) on inspectArgs.blueprintPath
(falling back to normalizedArgs.objectPath) and ensure it is non-empty (throw or
return an error that includes tools and the action name if invalid); then pass
the normalized blueprintPath in the payload to executeAutomationRequest and
include tool and action context in any error messages sent to the C++ bridge so
failures surface with proper diagnostics.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@src/tools/handlers/inspect-handlers.ts`:
- Around line 686-692: In the 'inspect_cdo' case, validate the requested action
with requireAction(args) and normalize/pre-validate blueprintPath from
InspectArgs before calling executeAutomationRequest: call normalizePath(...) on
inspectArgs.blueprintPath (falling back to normalizedArgs.objectPath) and ensure
it is non-empty (throw or return an error that includes tools and the action
name if invalid); then pass the normalized blueprintPath in the payload to
executeAutomationRequest and include tool and action context in any error
messages sent to the C++ bridge so failures surface with proper diagnostics.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 951c9963-0cb0-4334-80da-1ec41a9762fc

📥 Commits

Reviewing files that changed from the base of the PR and between 7faee4c and 5cb9d23.

📒 Files selected for processing (2)
  • plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_PropertyHandlers.cpp
  • src/tools/handlers/inspect-handlers.ts
✅ Files skipped from review due to trivial changes (1)
  • plugins/McpAutomationBridge/Source/McpAutomationBridge/Private/McpAutomationBridge_PropertyHandlers.cpp

@ChiR24 ChiR24 merged commit 970c161 into ChiR24:main Apr 3, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants