Skip to content

One AI tool catalogue for Studio, Radical Forge and the MCP server - #112

Merged
tomasz-zajac-oss merged 1 commit into
mainfrom
feat/mcp-metamodel-context
Oct 5, 2026
Merged

tomasz-zajac-oss merged 1 commit into
mainfrom
feat/mcp-metamodel-context

Conversation

@tomasz-zajac-oss

Copy link
Copy Markdown
Collaborator

Summary

All AI tools now live in @radical/common/ai/tools. Studio's AI chat, Radical Forge and the MCP server all use this one catalogue. A facade decides where an edit lands: in Studio's store, or in the headless model that the MCP server writes to a Markdown folder. The MCP server has only one tool of its own: get_model_summary.

New tools (available everywhere)

Area Tools
Nodes move_node: moves a node to a new parent or to the root. It keeps the node's canvas position and enforces the metamodel's allowedParents.
Views update_view changes the name, kind, linked sequence or hidden relations. create_view now also creates dynamic views.
Sequences create_sequence, update_sequence, delete_sequence. search_model adds LIST SEQUENCES and GET SEQUENCE <id>.
Presentations create_presentation, update_presentation, delete_presentation. Each slide shows one view, and Studio frames it to fit.
Metamodel upsert_node_type, delete_node_type, upsert_relation_type, delete_relation_type.
Layout smart_layout arranges All elements, or one static or dynamic view. It is the first async tool (runTool).
  • Radical Forge leaves out the metamodel and presentation groups (excludeToolGroups). The QuickSearch chat gets every tool.
  • Studio's runner rebuilds the tool schemas after a metamodel tool changes the types mid-run. It also refuses calls to tools that weren't offered.

MCP server

  • get_model_summary now returns the metamodel context message that the tool descriptions refer to: property keys, enum options, allowed parents and relation pairs. It also lists views, sequences and presentations. The server's instructions tell clients to call it first.
  • New and moved nodes are placed inside their parent, and the parents a change touches are refitted to their children.
  • defaultPositions in _layout.json now stays in step with node geometry. Before this, Studio restored stale positions when you switched back to All elements.
  • After a metamodel change, whether from a tool or from Studio, the server re-advertises the tool schemas (list_changed). A restart is no longer needed.
  • The README now explains how to connect Claude Code and Claude Desktop.

Shared code

  • checkReparent and reparentNodes (in @radical/common/model) and the metamodel message builder (@radical/common/ai/metamodelContext) moved out of Studio, and Studio's store uses them.
  • The view layout input, the parent fitting and new-node placement moved from the store to @radical/layout (viewInput.ts, geometry.ts).
  • The Smart Layout algorithm itself is unchanged.

Fix

Edits to a built-in metamodel are no longer lost. documentMetamodel replaces a preset id (c4-builtin, c4-ddd-builtin, c4-ddd-governance-builtin) with the current preset on load, which silently dropped Metamodel Editor edits. The Metamodel Editor and the metamodel tools now edit a …-custom copy instead. Such a copy no longer picks up later changes to the preset.

Behaviour to review

  • In Studio, smart_layout first switches to the view it lays out (or to All elements), because Studio lays out what is on screen.
  • Slides created by a tool have no captured viewport, so Studio fits each slide's view.

Tests

  • npm test passes in common (108), layout (48), ui (168), Studio (162) and mcp (6). Typechecks and check:workspaces are clean.
  • modelFacadeParity.test.ts runs the same tool calls against Studio's store and the headless facade. It now also covers moving nodes, views, sequences and the metamodel. It caught one difference, in how sequence step descriptions were stored, which is fixed.
  • The MCP tests drive a real stdio connection. They cover placement, smart_layout for All elements and for one view, presentations, and the metamodel copy with its schema refresh.
  • Not run locally: the Playwright e2e suite. Please check CI, since reparenting and the layout input in the store changed.
  • Not covered by a unit test: Studio's runLayout, because Studio's unit tests don't run ELK.

Open items are logged in docs/IMPROVEMENTS.md under "AI tool catalogue and MCP server (2026-10-05)".

🤖 Generated with Claude Code

…CP server

Every AI tool now lives in @radical/common/ai/tools, and a facade decides
where an edit lands: Studio's store, or the headless model that the MCP
server writes to a Markdown folder.

New tools: move_node, update_view and dynamic views, create/update/
delete_sequence, create/update/delete_presentation, upsert/delete node and
relation types, and an async smart_layout (All elements or one view).
search_model gains LIST SEQUENCES and GET SEQUENCE. Radical Forge leaves out
the metamodel and presentation groups (excludeToolGroups); the runner
rebuilds tool schemas when the metamodel changes mid-run.

MCP server: get_model_summary returns the metamodel context message that
the tool descriptions refer to, plus views, sequences and presentations.
New and moved nodes are placed inside their parent, parents are refitted,
defaultPositions stay in step with node geometry, and tool schemas are
re-advertised after a metamodel change.

Shared code: reparent rules (checkReparent/reparentNodes) and the metamodel
message move to @radical/common; the view layout input, parent fitting and
placement move to @radical/layout. Studio's store uses them.

Fix: editing a built-in metamodel (Metamodel Editor or tools) now works on
a "-custom" copy. documentMetamodel swaps a preset id back to the preset on
load, which silently dropped those edits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tomasz-zajac-oss
tomasz-zajac-oss merged commit 0c9fcad into main Oct 5, 2026
4 checks passed
@tomasz-zajac-oss
tomasz-zajac-oss deleted the feat/mcp-metamodel-context branch October 5, 2026 21:09
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