Skip to content

feat(mcp): room tools for shared multi-agent sessions (ent#169) - #1740

Merged
vybe merged 2 commits into
devfrom
feature/ent169-rooms-mcp
Jul 23, 2026
Merged

vybe merged 2 commits into
devfrom
feature/ent169-rooms-mcp

Conversation

@dolho

@dolho dolho commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

OSS half of Abilityai/trinity-enterprise#169 (enterprise module: Abilityai/trinity-enterprise#210).

Five MCP tools — create_room, list_rooms, read_room, post_to_room, close_room — proxying the enterprise rooms API. Tool code ships in the public server even though the feature is gated (Invariant #13).

Thin by design

All authorization is server-side and nothing here decides access:

  • Membership is the grant — a non-member gets a uniform 404 from the backend.
  • The acting identity comes from the API key, so an agent-scoped key always posts as its own agent and cannot post as another participant. There is no sender parameter to spoof.
  • The tools' only local logic is turning an absent/forbidden route into a structured result instead of a transport error.

Graceful fallback, verified

On an OSS build (or unentitled instance) the routes are absent, so the tools return:

{ "error": "shared_sessions_not_enabled",
  "message": "Shared sessions are not enabled on this Trinity instance." }

Verified live in both directions: with the module unregistered → the fallback above; with it registered → real data.

Live verification

Real MCP JSON-RPC with an agent's own TRINITY_MCP_API_KEY (tool count 100 → 105):

  • list_rooms → the agent's rooms with status, stop_reason, message and participant counts
  • read_room with since → transcript tail + participants
  • post_to_room → landed as #15 agent/portal-demo, i.e. recorded as the agent, resolved from auth context

Known gap

TrinityClient.request() takes no headers argument, so post_to_room cannot send an Idempotency-Key. The endpoint accepts one — Invariant #18 is satisfied at the boundary — but wiring it through the MCP client needs a client-signature change I didn't want to make unasked. Left as a follow-up.

Note for reviewers: the MCP server is a baked image, so docker compose build mcp-server is needed to pick these up; npm run build on the host is not enough.

🤖 Generated with Claude Code

dolho and others added 2 commits July 22, 2026 13:11
Five tools — create_room, list_rooms, read_room, post_to_room, close_room —
proxying the enterprise rooms API (Invariant #13: tool code ships in the public
server even when the feature is gated).

Thin by design: all authorization is server-side. Membership is the grant, the
acting identity comes from the API key (so an agent-scoped key always posts as
its own agent and cannot post as another participant), and a non-member gets a
uniform 404. Nothing here decides access.

On an OSS build the routes are absent, so the tools return a structured
"shared_sessions_not_enabled" result rather than throwing a transport error at
the agent — verified live against a backend with the module unregistered.

Known gap: TrinityClient.request() takes no headers argument, so post_to_room
cannot send an Idempotency-Key. The endpoint accepts one (Invariant #18 is
satisfied at the boundary); wiring it through the MCP client needs a client
signature change and is left as a follow-up.

Related to Abilityai/trinity-enterprise#169

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
_VALID_TRIGGERS is a filter allow-list, and an unrecognised value degrades to
None — i.e. NO filter — so an unlisted trigger silently returns EVERY execution
instead of that trigger's. Observed live before the fix:

    triggered_by=room          -> 14 rows, kinds=['agent','public','room']
    triggered_by=bogus-trigger -> 14 rows, kinds=['agent','public','room']

Identical to a garbage value: the filter lied rather than erroring or returning
nothing. ent#169 posts executions with triggered_by="room", so without listing
it the Sessions UI (ent#170) cannot filter room executions and any user
filtering for them gets silently wrong data.

Adding the string is not an enum/schema change — triggered_by is a plain TEXT
column and this set only gates the query filter.

After: triggered_by=room -> 8 rows, all kinds=['room'].

The broader wart (an INVALID value silently returning everything rather than
422) is pre-existing and left alone.

Related to Abilityai/trinity-enterprise#169

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@github-actions

Copy link
Copy Markdown

⚠️ Nightly unit-suite check skipped — merge conflict against dev.

Resolve by running git merge dev locally and pushing the result. The next nightly run will re-test once the conflict is gone.

@vybe vybe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validated: thin server-authorized proxy tools with structured not-enabled fallback + a real allow-list filter fix with named test. Enterprise rooms backend (ent#210) merged with the enumeration-oracle fix.

@vybe
vybe merged commit 5407535 into dev Jul 23, 2026
21 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.

2 participants