Skip to content

mcp: expose relationship/key-group/subject-area authoring + surface d… - #53

Merged
dbose merged 1 commit into
mainfrom
fix-mcp-write-surface
Oct 6, 2026
Merged

dbose merged 1 commit into
mainfrom
fix-mcp-write-surface

Conversation

@dbose

@dbose dbose commented Oct 6, 2026

Copy link
Copy Markdown
Owner

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):

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

…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.
@dbose
dbose merged commit 7dd170b into main Oct 6, 2026
2 checks passed
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.

1 participant