Repository navigation
mcp: expose relationship/key-group/subject-area authoring + surface d… - #53
Merged
Merged
Conversation
…omain hints Real-usage feedback: the MCP agent write surface lagged the CLI/canvas. An agent building an FX-rates model had to hand-author relationship and key-group YAML by guessing ULIDs and copying schema, because those ops were reachable only from the CLI. Close the gap by exposing them as first-class MCP tools over the same validated apply_command bus the canvas and CLI use. New write tools (ULIDs minted server-side and returned as created_id): - create_subject_area - create_relationship (incl. one-gesture create_from_fk that mints the FK column) - create_key_group (ordered members, pk/alternate/unique/index) ULIDs: - Read tools (list_entities, get_entity) now return the entity id and each attribute id, so an agent grounds relationship endpoints / key members on real ULIDs instead of guessing. - mint_ulid tool for the pre-mint-then-reference pattern (apply_command's _id_from already validates a supplied ULID), so an agent never hand-writes an id that could collide and corrupt diff/merge. Domain mismatches (MDL-E114) were silent over MCP: the check already runs on every write, but update_entity discarded the diagnostics. Thread them through — update_entity now returns `diagnostics` plus the new attribute's `attribute_id`, and both update_entity and the create tools surface foreign-key domain mismatches as `domain_hints` inline, instead of only on a later explicit validate. Tests: new MCP cases for each tool, the add-attribute→key-group id handoff, the bad-endpoint / foreign-member error paths, mint_ulid validity, diagnostics threading, and an end-to-end FK domain-mismatch hint. 31 MCP + 506 core/cli/ reverse green; ruff clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MCP Improvements
Real-usage feedback: the MCP agent write surface lagged the CLI/canvas. An agent building a logical model had to hand-author relationship and key-group YAML by guessing ULIDs and copying schema, because those ops were reachable only from the CLI. Close the gap by exposing them as first-class MCP tools over the same validated apply_command bus the canvas and CLI use.
New write tools (ULIDs minted server-side and returned as created_id):
ULIDs:
Domain mismatches (MDL-E114) were silent over MCP: the check already runs on every write, but update_entity discarded the diagnostics. Thread them through — update_entity now returns
diagnosticsplus the new attribute'sattribute_id, and both update_entity and the create tools surface foreign-key domain mismatches asdomain_hintsinline, instead of only on a later explicit validate.Tests: new MCP cases for each tool, the add-attribute→key-group id handoff, the bad-endpoint / foreign-member error paths, mint_ulid validity, diagnostics threading, and an end-to-end FK domain-mismatch hint. 31 MCP + 506 core/cli/ reverse green; ruff clean.