Skip to content

feat(mcp): host-neutral assembly joint create/update - #68

Closed
jeffglousher wants to merge 3 commits into
jackControls:mainfrom
jeffglousher:feat/mcp-assembly-joints
Closed

feat(mcp): host-neutral assembly joint create/update#68
jeffglousher wants to merge 3 commits into
jackControls:mainfrom
jeffglousher:feat/mcp-assembly-joints

Conversation

@jeffglousher

Copy link
Copy Markdown
Collaborator

Summary

  • Expose host-neutral assembly joints as MCP tools (Direct → host::handle), the slice deferred on feat(mcp): host-neutral assembly component tools #62.
  • Tools: assembly_create_joint (CreateJointRequestDto) and assembly_update_joint (UpdateJointRequestDto). Query stays assembly_document / assembly_solution (already on main).
  • Schemas match the landed host DTOs (kind, topology-backed connectors, limits, advanced, optional grounded body/occurrence).
  • New headless golden assembly_joint_create_update_query_roundtrip: two extruded boxes → revolute joint → assembly_document query → rename/limits update → solution still non-empty. No cad_attach.

Why

#62 shipped component/occurrence/pose/grounded and left joints for a follow-up once schemas stayed small. Host already has stable CreateJointRequestDto / UpdateJointRequestDto and assembly_create_joint / assembly_update_joint engine methods.

What is NOT done

Test plan

  • cargo test --manifest-path mcp-server/Cargo.toml --bin nbcad-mcp -- --test-threads=1
    • 38 passed, including assembly_joint_create_update_query_roundtrip
    • registry / focus-pack matrix now 119 modeling tools (assembly pack 10)
  • rustfmt on the two MCP files

Refs

Follow-up to #62. Does not touch #60/#63.

@jeffglousher
jeffglousher force-pushed the feat/mcp-assembly-joints branch from 1cb29a7 to eaf9f0f Compare August 25, 2026 14:59
@jeffglousher

Copy link
Copy Markdown
Collaborator Author

Rebased onto latest main (a0015f0, #67). Clean rebase — no conflicts (mcp-server only; independent of #60). New tip: eaf9f0f. mcp-server 38 green including assembly_joint_create_update_query_roundtrip. 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.

Thanks for expanding the assembly MCP surface. I rechecked the current head (eaf9f0f). One schema/round-trip compatibility issue remains:

The advertised joint tool schemas reject valid joint JSON produced by the server itself. source_surface_frame and the optional joint limit fields are declared as object-only in the create/update schemas, while the Rust DTOs serialize absent Option values as explicit null. A strict MCP client that validates tool input against tools/list therefore cannot pass an unmodified assembly_joint_query result back into create/update. The existing round-trip test calls CadServer::call_tool directly, so it bypasses advertised-schema validation and does not catch this.

Please allow both object and null for these nullable fields (including the advanced joint limit variants) and add a round-trip test that validates the queried payload against the advertised input schema before submitting it.

@jeffglousher

Copy link
Copy Markdown
Collaborator Author

Addressed the schema/round-trip review on 3a071a6.

Fix: advertised assembly_create_joint / assembly_update_joint schemas now accept object-or-null for the fields that serialized DTOs emit as null:

  • source_surface_frame
  • primary limits: limits, angle_limits, linear_limits
  • advanced limits: secondary_angle_limits, tertiary_angle_limits, secondary_linear_limits

Test: assembly_joint_query_validates_against_advertised_update_schema queries a created joint, validates { joint } against the tools/list assembly_update_joint inputSchema, then submits via tools/call (not only CadServer::call_tool).

mcp-server: rustfmt clean; clippy -D warnings on the new code (pre-existing chunks_exact_to_as_chunks / manual_contains elsewhere unchanged). cargo test 39 green.

Not merging.

jeffglousher added a commit to jeffglousher/noBS-CAD that referenced this pull request Aug 25, 2026
jackControls#68 adds host-neutral assembly_create_joint / assembly_update_joint.
Stack those ToolSpecs on jackControls#60's MUTATES map so cad_submit accepts them
while attached. assembly_document / assembly_solution stay read-safe.
jackControls
jackControls previously approved these changes Aug 25, 2026

@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.

Thanks for the update. The advertised schemas now accept null for every optional joint field emitted by the DTOs, including connector source frames and primary/advanced limits. The regression test validates a queried joint against the tools/list schema before updating it, and the focused test plus MCP CI pass. Approved.

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.
Serialized JointDefinitionDto emits null for source_surface_frame and
limit objects. Advertised create/update schemas now allow object-or-null
so a queried joint can pass protocol-level inputSchema validation.
@jeffglousher

Copy link
Copy Markdown
Collaborator Author

Rebased onto latest upstream/main (0fecc57, #60 merged). Kept object-or-null advertised joint fields (source_surface_frame + primary/advanced limits) and assembly_joint_query_validates_against_advertised_update_schema.

Conflicts were tool-count (MODELING_TOOL_COUNT 119 + 22 helpers) and the shared-mutate classifier test — both kept. New tip: b2d23e6.

Local: assembly_joint_create_update_query_roundtrip, assembly_joint_query_validates_against_advertised_update_schema, tool_registry_is_granular_and_protocol_lists_revolve, every_shared_mutate_is_accepted_by_cad_submit_classifier green. Not merging — rebase dismissed the prior approval.

@jeffglousher

Copy link
Copy Markdown
Collaborator Author

Closing as superseded by #69 (df875a0 / tip fad8dca).

Main already has this PR’s surface: assembly_create_joint / assembly_update_joint ToolSpecs, object-or-null advertised schemas (source_surface_frame + primary/advanced limits), mutate-map registration (the 08a94235 hunk), Assembly disclosure tags, and both goldens (assembly_joint_create_update_query_roundtrip, assembly_joint_query_validates_against_advertised_update_schema).

Leftover vs this head is only #69 follow-on (stronger replace-all update description + extra adversarial coverage). Rebasing onto current main would re-apply already-landed hunks on files #69 expanded — leftover, not unique work.

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