Skip to content

feat(mcp): host-neutral assembly component tools - #62

Merged
jackControls merged 3 commits into
jackControls:mainfrom
jeffglousher:feat/mcp-assembly-tools
Aug 23, 2026
Merged

feat(mcp): host-neutral assembly component tools#62
jackControls merged 3 commits into
jackControls:mainfrom
jeffglousher:feat/mcp-assembly-tools

Conversation

@jeffglousher

Copy link
Copy Markdown
Collaborator

Summary

  • Expose host-neutral assembly ops as first-class MCP tools (Direct → host::handle), so agents can build real assemblies (NIST FTC / print-kit style) without hand-editing model.json.
  • Tools: assembly_document, assembly_solution, assembly_create_component, assembly_update_component, assembly_create_occurrence, assembly_update_occurrence, assembly_set_occurrence_pose, assembly_set_occurrence_grounded.
  • New assembly focus pack in disclosure (ribbon-aligned); schemas match CreateComponentRequestDto / occurrence / pose / grounded DTOs.
  • Out of scope: joints (assembly_create_joint / delete) deferred to a follow-up when schemas stay small.

Test plan

  • cargo test in mcp-server (32 passed), including assembly_component_occurrence_grounded_roundtrip (new project → extrude box → create component absorb → set pose/grounded → assembly_document shows component; headless, no attach)
  • Registry / focus-pack matrix counts updated (113 modeling tools)

@jackControls jackControls left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The update ToolSpec schemas permit destructive partial replacement.

assembly_update_component requires only id and name, but deserialization defaults omitted body_ids to [], the local coordinate system to identity, and promoted to false. AssemblyModel::update_component then replaces the whole definition. A valid rename-only call can therefore silently remove every body from the component and reset its coordinate system.

Likewise, assembly_update_occurrence requires only id, name, and component_id; omitted parent, pose, visibility, and grounded values deserialize to defaults before the whole occurrence is replaced. A rename-only call can reparent/reposition/show/unground an occurrence.

Please either require every replacement field in both schemas or introduce patch DTOs that preserve omitted values, with rename-only regression tests. Requesting changes; I did not merge.

@jeffglousher

Copy link
Copy Markdown
Collaborator Author

Addressed CHANGES_REQUESTED with patch DTOs (Option B): ComponentDefinitionPatchDto / ComponentOccurrencePatchDto — only id required; host update_component / update_occurrence preserve omitted fields. ToolSpecs updated. Rename-only MCP tests + assembly unit test assert bodies/LCS/pose/parent/visibility/grounded unchanged. Not merging.

@jackControls jackControls left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Re-reviewed at b6d6543. The patch DTO semantics, omitted-field preservation, and explicit-null parent clearing now look correct; the targeted assembly and MCP preservation tests pass locally. The remaining blocker is the failed required MCP check: reports formatting diffs in and . Please run and push the result.

@jackControls jackControls left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Re-reviewed at b6d6543. The patch DTO semantics, omitted-field preservation, and explicit-null parent clearing now look correct; the targeted assembly and MCP preservation tests pass locally. The remaining blocker is the failed required MCP check: cargo fmt --all -- --check reports formatting diffs in crates/assembly/src/lib.rs and crates/sketch/src/lib.rs. Please run cargo fmt --all and push the result.

@jeffglousher

Copy link
Copy Markdown
Collaborator Author

fmt only

Add Direct MCP ToolSpecs for assembly_document, assembly_solution,
create/update component and occurrence, set pose, and set grounded so
agents can build real assemblies without hand-editing model.json.
Joints deferred. Register a dedicated assembly focus pack and cover
the flow with a headless roundtrip test.
Introduce ComponentDefinitionPatchDto / ComponentOccurrencePatchDto with
optional fields (id required). Host update_component / update_occurrence
merge omitted values instead of full-replacing with serde defaults.
Rename-only MCP + assembly regression tests cover the wipe bug Jack flagged.
@jeffglousher
jeffglousher force-pushed the feat/mcp-assembly-tools branch from f41edb7 to 695b410 Compare August 23, 2026 14:23
jeffglousher added a commit to jeffglousher/noBS-CAD that referenced this pull request Aug 23, 2026
Stack assembly ToolSpecs (jackControls#62) onto the UI-owned apply / mcp-mutate
branch (jackControls#60) so cad_submit accepts assembly_create_component,
assembly_update_component, assembly_create_occurrence,
assembly_update_occurrence, assembly_set_occurrence_pose, and
assembly_set_occurrence_grounded while attached. assembly_document and
assembly_solution stay read-safe inspect tools. Add Assembly focus pack
and classifier/roundtrip coverage.
@jeffglousher

Copy link
Copy Markdown
Collaborator Author

Rebased onto upstream/main (5248caf, includes #61). New tip: 695b410.

  • Resolved disclosure/main MODELING_TOOL_COUNT117 (109 + 8 assembly) with +21 control helpers.
  • Kept patch DTOs + rename preservation tests; cargo fmt --all clean.
  • Tests: mcp-server 37 passed (no mcp-mutate crate on this branch).
  • History rewritten — please re-review.

@jackControls jackControls left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Re-reviewed at 695b410. The patch DTOs now preserve omitted component and occurrence fields, explicit null correctly clears an occurrence parent, validation remains transactional, and formatting is clean. Local verification passed: 32 assembly tests and all 37 MCP-server tests. Approved.

@jackControls
jackControls merged commit affb1f0 into jackControls:main Aug 23, 2026
6 checks passed
jeffglousher added a commit to jeffglousher/noBS-CAD that referenced this pull request Aug 25, 2026
Rebase jackControls#63 onto jackControls#60 tip f241739. Mutate map entries and ToolSpecs already
landed with jackControls#60/jackControls#62; keep unique classifier/lookup coverage so cad_submit
accepts the six assembly modeling mutates while assembly_document and
assembly_solution stay read-safe inspect tools.
jeffglousher added a commit to jeffglousher/noBS-CAD that referenced this pull request Aug 25, 2026
Rebase jackControls#63 onto jackControls#60 tip f241739. Mutate map entries and ToolSpecs already
landed with jackControls#60/jackControls#62; keep unique classifier/lookup coverage so cad_submit
accepts the six assembly modeling mutates while assembly_document and
assembly_solution stay read-safe inspect tools.
jeffglousher added a commit to jeffglousher/noBS-CAD that referenced this pull request Aug 25, 2026
Rebase jackControls#63 onto jackControls#60 tip f241739. Mutate map entries and ToolSpecs already
landed with jackControls#60/jackControls#62; keep unique classifier/lookup coverage so cad_submit
accepts the six assembly modeling mutates while assembly_document and
assembly_solution stay read-safe inspect tools.
jeffglousher added a commit to jeffglousher/noBS-CAD that referenced this pull request Aug 25, 2026
Assembly joints were deferred on jackControls#62. Host already has stable
CreateJointRequestDto / UpdateJointRequestDto; this slice adds matching
MCP tools plus a headless two-body revolute create/update/query golden.
jeffglousher added a commit to jeffglousher/noBS-CAD that referenced this pull request Aug 25, 2026
Rebase jackControls#63 onto jackControls#60 tip f241739. Mutate map entries and ToolSpecs already
landed with jackControls#60/jackControls#62; keep unique classifier/lookup coverage so cad_submit
accepts the six assembly modeling mutates while assembly_document and
assembly_solution stay read-safe inspect tools.
jeffglousher added a commit to jeffglousher/noBS-CAD that referenced this pull request Aug 25, 2026
Assembly joints were deferred on jackControls#62. Host already has stable
CreateJointRequestDto / UpdateJointRequestDto; this slice adds matching
MCP tools plus a headless two-body revolute create/update/query golden.
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.

2 participants