Let the AI manage inbox channels through tools

Merged
FE
2d ago
+598-47

The AI chat and MCP clients had no tools for inbox channels. Channels could only be managed from Settings → AI, or through GraphQL by a signed-in user.

What changes

Four tools under a new INBOX_CHANNEL tool category:

ToolAccess
list_inbox_channelsAI permission. Returns every channel with isAccessible. Callers who can manage channels also get assignableRoles.
create_inbox_channelAI + AI_SETTINGS. Takes a name, an optional icon and color, and the roles it is open to.
update_inbox_channelAI + AI_SETTINGS. Changes the name, icon, color, position or roles. Setting roles rewrites conversation grants, as the Settings page does.
delete_inbox_channelAI + AI_SETTINGS, destructive. Needs a destination when the channel still has conversations. Standard channels are refused.
  • The tools call AgentChatChannelService, so validation, grant rewrites and the delete lock match the GraphQL mutations.
  • The two access policies move out of the resolver into constants that the resolver and the tools share. API keys stay excluded, as they are on the resolver.
  • The MCP server instructions and the tool catalog list the new category.

Tests

  • New mcp-inbox-channel-tools.integration-spec.ts:
    • learn_tools finds all four tools;
    • an admin creates, renames, re-roles, deletes and lists a channel;
    • a member gets no assignableRoles and cannot create a channel.
  • endpoint-permission-declarations snapshot: added the four tools by hand, from the resolver's entries plus withAgent. This snapshot and the new spec have not been run locally (no Postgres in my environment), so CI is their first run.
  • tsgo --noEmit and lint:diff-with-main pass on twenty-server.

Related: a separate PR will let apps ship inbox channels as code (defineInboxChannel).


Generated by Claude Code