Skip to content

feat: wire WithReflectorModulesFromAssembly into the Unity MCP plugin build#805

Merged
IvanMurzak merged 1 commit into
mainfrom
worktree-801-wire-reflector-modules-from-assembly
Jun 4, 2026
Merged

feat: wire WithReflectorModulesFromAssembly into the Unity MCP plugin build#805
IvanMurzak merged 1 commit into
mainfrom
worktree-801-wire-reflector-modules-from-assembly

Conversation

@IvanMurzak
Copy link
Copy Markdown
Owner

Summary

  • Wire .WithReflectorModulesFromAssembly(assemblies) into BuildMcpPlugin(...) so any loaded assembly (including extensions added later, unknown ahead of time) auto-registers its own ReflectorNet JSON/reflection converters, serialization-blacklist entries, and attribute-scan prune rules via an IReflectorModule — no hardcoded extension list. Discovery honors the existing .IgnoreAssemblies(...) core prune and runs before the heavy attribute scan; CreateDefaultReflector() stays the Order=0 baseline.
  • Add ReflectorModuleDiscoveryTests (guarded behind the test-only Editor.Tests asmdef) proving all four contribution surfaces reach effect via dynamic discovery, that a throwing module is isolated, and that an ignored hosting assembly is never type-enumerated.
  • Commit a cross-repo dependency stub: the flat McpPlugin.dll (all 6 destinations) is replaced with a Release netstandard2.1 build of MCP-Plugin-dotnet main at 2fed761 carrying the IReflectorModule API (the published 6.5.5 NuGet predates it). This is the only thing CI compiles against; see the stub commit body for the follow-up obligation once a release ships.

Test plan

  • Unity EditMode suite green: 965/965 passed, 0 failed (the 3 new ReflectorModuleDiscoveryTests discovered + passing).
  • Unity PlayMode suite green: 1/1 passed, 0 failed.
  • Verified locally against the rebuilt McpPlugin.dll carrying the new API.

Closes #801

… build

Add .WithReflectorModulesFromAssembly(assemblies) to the McpPluginBuilder
chain in BuildMcpPlugin(...), alongside the existing
.WithToolsFromAssembly(assemblies) etc. (assemblies = AssemblyUtils.AllAssemblies).
Any loaded assembly - including extensions added later, unknown ahead of
time - can now auto-register its own ReflectorNet JSON/reflection converters,
serialization-blacklist entries, and attribute-scan prune rules via an
IReflectorModule, without a hardcoded extension list.

Discovery honors the existing .IgnoreAssemblies(...) core prune (heavy
assemblies are never type-enumerated) and runs strictly before the heavy
attribute scan inside Build(). The hardcoded core converters/blacklist in
CreateDefaultReflector() stay the Order=0 baseline; module contributions
layer on top.

Add a verification suite (ReflectorModuleDiscoveryTests, guarded behind the
test-only Editor.Tests asmdef) that drives McpPluginBuilder directly with a
throwaway in-repo IReflectorModule carrying zero hardcoded reference, proving
end to end: (1) a contributed JSON converter, (2) a contributed reflection
converter, (3) a contributed serialization-blacklist type, and the
scan-ignore surface all reach effect via dynamic discovery; a deliberately
throwing module is isolated (the healthy sibling still runs); and an
ignored hosting assembly is never type-enumerated (perf guarantee). Add
Microsoft.Extensions.DependencyInjection.Abstractions.dll to the test
asmdef precompiledReferences (transitively required by the McpPluginBuilder
ctor signature).

Closes #801
@IvanMurzak IvanMurzak force-pushed the worktree-801-wire-reflector-modules-from-assembly branch from 6fc8941 to 99addf0 Compare June 4, 2026 08:12
@IvanMurzak IvanMurzak merged commit d4544c9 into main Jun 4, 2026
17 checks passed
@IvanMurzak IvanMurzak deleted the worktree-801-wire-reflector-modules-from-assembly branch June 4, 2026 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wire WithReflectorModulesFromAssembly into the Unity MCP plugin build (extension converters)

1 participant