Repository navigation
feat(v6.50.0): MCP + CLI relationship tools (ADR-249, #298) - #300
Merged
Merged
Conversation
Agents could create elements but not connect them: the MCP server and
CLI had no relationship tools, so new elements showed no relationships,
diagram edges couldn't carry a real relationshipId, and imported roles
couldn't be corrected.
Backend
- POST /api/batch/relationships/create (1-100 items, per-item failure
isolation, BatchResultWithIds). Each item is validated by
validate_new_relationship (endpoints exist, not self-referencing, same
set) and checked against collection write-scope via its source element.
- source_role / target_role map to data.sourceRole / data.targetRole (the
Sparx importer and canvas convention) via apply_role_fields; every
relationship response now returns derived source_role / target_role.
- PUT /api/relationships/{id}: relationship_type updatable (omit keeps;
change recorded in change_summary), role fields merge into data.
- GET /api/relationships: set_id (either end) + relationship_type filters.
- The validation is on the agent (batch) path only: create_relationship
and the single POST keep accepting reflexive relationships, which the
canvas self-loop, Sparx reflexive associations and edge auto-create rely
on. No relationship-type registry exists in the backend, so types are
not validated against notations (recorded in ADR-249).
Shared client / MCP / CLI
- IrisClient: create_relationships, list_relationships, get_relationship,
update_relationship (reads version for If-Match, partial merge, role
keys carry over), delete_relationship.
- MCP tools: create_relationships, update_relationship,
list_relationships, get_relationship, delete_relationship; server
instructions (seed + fallback) point agents at them.
- CLI: iris create relationship|relationships, iris update relationship,
iris delete relationship, iris relationships list|get.
- check_surface_parity.py: relationship is a known entity; batch routes
and plural batch tool/command names are attributed to their entity.
Tests (written first): backend agent-surface suite (batch create, roles,
self/cross-set/missing rejections, scope, type update, list filters,
diagram edge relationshipId reuse without duplicates, single POST
unchanged), parity-script tests, iris-client/MCP/CLI unit tests, and an
end-to-end MCP lifecycle test against a real backend.
Docs: ADR-249, SPEC-249-A, CHANGELOG, README, docs/api.md, docs/mcp.md,
docs/cli.md, mcp + cli READMEs. Version 6.50.0 (backend, frontend,
iris-client, iris-mcp).
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01EbTwcTX1wKVooS7oWd7cP9
…ship reads need sign-in (ADR-249, #298) Review follow-ups on the relationship tools. Root cause 1: the diagram-edge auto-create ignored edge data.relationshipId and only deduped on a same-direction source/target pair. An agent reusing a create_relationships id on an edge drawn target -> source got a reversed duplicate relationship on save. Fix: before the pair dedup, skip an edge whose data.relationshipId names a live relationship linking the same two elements in either direction. A relationshipId for other elements (stale/copied edge) is ignored. The create_relationships description now states the edge direction. Root cause 2: GET /api/relationships[/{id}] require auth, but the MCP server instructions (seed + fallback) said every get_*/list_* works without sign-in, so an anonymous agent following the new workflow failed at list_relationships. Fix: the AUTH RECOVERY text and the list_relationships / get_relationship descriptions say they need sign-in. Opening the routes to anonymous callers is recorded as a rejected option in ADR-249 (changes a pre-existing access contract). Tests (written first, reversed-edge test seen failing 2 == 1): reversed edge reuse creates no duplicate; foreign relationshipId doesn't suppress the create; seed/fallback instructions and tool descriptions mention sign-in and edge direction. Docs: ADR-249, SPEC-249-A, CHANGELOG [6.50.0], mcp/README.md. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01EbTwcTX1wKVooS7oWd7cP9
This was referenced Sep 24, 2026
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.
Problem
Agents using the Iris MCP server or CLI could create elements but had no way to connect them (issue #298):
relationshipId.The backend also couldn't change a relationship's type after creation, or list relationships by set or type.
Fix
Backend
POST /api/batch/relationships/create:BatchResultWithIds).source_role/target_roleare stored asdata.sourceRole/data.targetRole, the convention the Sparx importer and canvas already use. Every relationship response now also returnssource_roleandtarget_role.PUT /api/relationships/{id}can changerelationship_typeand accepts role fields.GET /api/relationshipsgainsset_idandrelationship_typefilters.data.relationshipId. An edge naming a live relationship between the same two elements, in either direction, doesn't create a duplicate.Shared client, MCP and CLI
IrisClientgainscreate_relationships,list_relationships,get_relationship,update_relationshipanddelete_relationship. The update reads the current version for If-Match and applies a partial merge.create_relationships,update_relationship,list_relationships,get_relationship,delete_relationship.iris create relationship|relationships,iris update relationship,iris delete relationship,iris relationships list|get.list_relationships/get_relationshipneed sign-in, because the REST reads require auth, unlike element reads.Surface parity
scripts/check_surface_parity.pynow enforcesrelationship./api/batch/<entities>/<verb>routes, and plural tool/command names, to their entity.Tests
pytest --ignore=tests/test_startup.py): 15 failed, 2076 passed, 9 skipped.mainand are unrelated to this change: 6 intest_entity_indexing::TestElementCrudIndexing, 5 intest_rebuild::TestRebuildSearchIndex,test_convert_raises_for_non_jet4,test_import_accepts_eap_extension, and 2 intest_mnemos.tests/test_relationships,test_batch,test_scriptsandtest_diagrams: 370 passed.2 == 1), and arelationshipIdbelonging to other elements doesn't suppress the create.main:test_create_element_schema_requires_type_and_nameandtest_create_element_template_required_fieldsexpect contradictory things.test_info_includes_package_versionfails because the package isn't installed as a distribution.update_diagramedge, and delete.scripts/check_surface_parity.pyreports "Parity clean".PYTHONPATHpointing at the branch sources, because the checked-in mcp/cli venvs point at a Python 3.12 that is no longer installed.Rollout / merge notes
mainafter fix(v6.49.2): PATs 500 on Supabase deployments (ADR-247) #297 (v6.49.2), so it merges cleanly today.ADR / Spec
docs/adrs/ADR-249-Relationship-Tools-For-Agents.mddocs/adrs/specs/SPEC-249-A-Relationship-Tools-For-Agents.mdFollow-up: the issue's "nice to have" helper that adds nodes/edges to a diagram without resending the whole canvas. It is listed in ADR-249 as out of scope.
Closes #298
🤖 Generated with Claude Code
https://claude.ai/code/session_01EbTwcTX1wKVooS7oWd7cP9