Skip to content

The agent that grows with you

feat(connectors): manage_connections display waits on a directory card

alt-glitchb1d0fe60607f
diff --git a/agent/inline_tool_executors.py b/agent/inline_tool_executors.py
index 75a497d3b59..0dfce99282f 100644
--- a/agent/inline_tool_executors.py
+++ b/agent/inline_tool_executors.py
@@ -188,6 +188,7 @@ def _manage_connections(agent, args: dict, ctx: InlineToolContext) -> Any:
turn_id=getattr(agent, "_current_turn_id", None) or None,
connection_callback=getattr(agent, "connection_callback", None),
connectors_available=gateway_config.connectors_available,
+ card_surface=getattr(agent, "platform", None) == "desktop",
)
_scope_in_connected_mcp_servers(agent, result)
return result
diff --git a/apps/shared/src/gateway-contract.generated.ts b/apps/shared/src/gateway-contract.generated.ts
index 6c49e4eb968..6f24a8fa689 100644
--- a/apps/shared/src/gateway-contract.generated.ts
+++ b/apps/shared/src/gateway-contract.generated.ts
@@ -1115,6 +1115,7 @@ export interface ConnectionRespondParams {
export interface ConnectionAnswer {
targets?: ConnectionAnswerTarget[]
settled_by?: ConnectionSettleReason | null
+ said?: string | null
}
/** One row's answer from the card. ``env`` carries the credential values an install asked for through ``required_env``. */
export interface ConnectionAnswerTarget {
@@ -3155,6 +3156,11 @@ export interface ConnectionRequestPayload {
timeout_seconds: number
targets: ConnectionOperationTarget[]
tool_call_id?: string | null
+ display?: ConnectionDisplay | null
+}
+/** ``manage_connections`` action ``display``: the directory card, with these slugs pinned as Suggested. */
+export interface ConnectionDisplay {
+ suggested: string[]
}
/** ``tool_progress._normalize_todo_state``: the authoritative todo snapshot. */
export interface TodoState {
diff --git a/apps/shared/src/gateway-contract.openrpc.json b/apps/shared/src/gateway-contract.openrpc.json
index fb9663d6cad..32d12d05efc 100644
--- a/apps/shared/src/gateway-contract.openrpc.json
+++ b/apps/shared/src/gateway-contract.openrpc.json
@@ -9243,6 +9243,18 @@
}
],
"default": null
+ },
+ "said": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Said"
}
},
"title": "ConnectionAnswer",
@@ -9303,6 +9315,24 @@
"title": "ConnectionAnswerTarget",
"type": "object"
},
+ "ConnectionDisplay": {
+ "additionalProperties": false,
+ "description": "``manage_connections`` action ``display``: the directory card, with these slugs pinned as Suggested.",
+ "properties": {
+ "suggested": {
+ "items": {
+ "type": "string"
+ },
+ "title": "Suggested",
+ "type": "array"
+ }
+ },
+ "required": [
+ "suggested"
+ ],
+ "title": "ConnectionDisplay",
+ "type": "object"
+ },
"ConnectionOperationParams": {
"additionalProperties": false,
"properties": {
@@ -9844,6 +9874,17 @@
],
"default": null,
"title": "Tool Call Id"
+ },
+ "display": {
+ "anyOf": [
+ {
+ "$ref": "#/components/schemas/ConnectionDisplay"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null
}
},
"required": [
diff --git a/tests/fixtures/prompt_surface/surfaces.json b/tests/fixtures/prompt_surface/surfaces.json
index a99eb1e1fa3..c95339e704f 100644
--- a/tests/fixtures/prompt_surface/surfaces.json
+++ b/tests/fixtures/prompt_surface/surfaces.json
@@ -5,7 +5,7 @@
"stable": 1935,
"volatile": 1813
},
- "tool_tokens": 13264,
+ "tool_tokens": 13402,
"tools": [
"browser_back",
"browser_cdp",
@@ -48,7 +48,7 @@
"stable": 1445,
"volatile": 1813
},
- "tool_tokens": 13264,
+ "tool_tokens": 13402,
"tools": [
"browser_back",
"browser_cdp",
@@ -91,7 +91,7 @@
"stable": 1866,
"volatile": 1811
},
- "tool_tokens": 13264,
+ "tool_tokens": 13402,
"tools": [
"browser_back",
"browser_cdp",
@@ -134,7 +134,7 @@
"stable": 2640,
"volatile": 1809
},
- "tool_tokens": 13420,
+ "tool_tokens": 13557,
"tools": [
"browser_back",
"browser_cdp",
@@ -177,7 +177,7 @@
"stable": 1445,
"volatile": 1813
},
- "tool_tokens": 13264,
+ "tool_tokens": 13402,
"tools": [
"browser_back",
"browser_cdp",
@@ -220,7 +220,7 @@
"stable": 1317,
"volatile": 1813
},
- "tool_tokens": 13264,
+ "tool_tokens": 13402,
"tools": [
"browser_back",
"browser_cdp",
@@ -263,7 +263,7 @@
"stable": 1579,
"volatile": 1814
},
- "tool_tokens": 13900,
+ "tool_tokens": 14038,
"tools": [
"browser_back",
"browser_cdp",
@@ -307,7 +307,7 @@
"stable": 1349,
"volatile": 1814
},
- "tool_tokens": 13264,
+ "tool_tokens": 13402,
"tools": [
"browser_back",
"browser_cdp",
@@ -350,7 +350,7 @@
"stable": 1382,
"volatile": 1814
},
- "tool_tokens": 13264,
+ "tool_tokens": 13402,
"tools": [
"browser_back",
"browser_cdp",
diff --git a/tests/fixtures/prompt_surface/tools/manage_connections.json b/tests/fixtures/prompt_surface/tools/manage_connections.json
index 0ee29ee7b57..870709d5374 100644
--- a/tests/fixtures/prompt_surface/tools/manage_connections.json
+++ b/tests/fixtures/prompt_surface/tools/manage_connections.json
@@ -1,11 +1,12 @@
{
- "description": "Connect the user to apps. Two kinds: a hosted connector account (Gmail, Notion, ...) served through the tool gateway, and a local MCP server from the bundled catalog. Targets go in 'connectors': a bare slug or {\"name\": \"gmail\"} is a hosted connector account; {\"name\": \"linear\", \"mcp\": true} is a local MCP server. Many names exist on both sides, so the user's own words decide. Pass \"mcp\": true only when the user asks for an MCP server, a local server or an install, or when the name exists only as a catalog entry; otherwise the target is hosted. 'connect' and 'reconnect' are hosted actions; 'install', 'enable' and 'authorize' are MCP actions. A target the other side owns is refused with the call that does work. Hosted actions: 'status' lists connectors and whether each is connected; 'connect' starts an authorization for the given connectors; 'reconnect' checks each one and repairs only what is not connected ('force': true restarts even a working one, for an account switch). A second account of one app is 'connect' with a new 'alias': pick a short lowercase name from the user's words (e.g. 'work'), and ask the user if unsure. 'status' lists each connector's accounts; 'rename' names or renames one. Pass SEVERAL slugs in one call. In the desktop app, the terminal UI and the interactive CLI the call shows the user a card and blocks until every app is connected, skipped, or the deadline passes; the result lists each target as connected / skipped / not_connected and never carries a link. Where no card exists (a one-shot run, a scheduled job, a messaging platform) the result carries a connect_url per app for the USER to open in a browser (never open it yourself); ask them to say when they are done, then use 'status'. When a hosted connector tool call returns CONNECTION_REQUIRED, use 'connect'. MCP actions (every target must carry \"mcp\": true): 'install' adds a catalog entry, 'enable' re-enables a disabled configured server, 'authorize' runs its OAuth. They show the user an approval card and block until it settles. Never hand-edit mcp_servers config — always use this tool. After a skip or a timeout, do not re-ask on your own: continue without the app or ask in chat. A later request from the USER for that same app is not a re-ask — run it. A connected server's tools are named in the result and are callable at once through tool_describe/tool_call. Where no card exists an MCP target runs at once and the result says what happened, with a link for the user to open when one is needed. This tool can NOT disconnect, delete, or revoke an account — that is deliberately user-only. When asked, say so and direct the user to the Nous Portal (their org's Connectors page) or the desktop app.",
+ "description": "Connect the user to apps. Two kinds: a hosted connector account (Gmail, Notion, ...) served through the tool gateway, and a local MCP server from the bundled catalog. Targets go in 'connectors': a bare slug or {\"name\": \"gmail\"} is a hosted connector account; {\"name\": \"linear\", \"mcp\": true} is a local MCP server. Many names exist on both sides, so the user's own words decide. Pass \"mcp\": true only when the user asks for an MCP server, a local server or an install, or when the name exists only as a catalog entry; otherwise the target is hosted. 'connect' and 'reconnect' are hosted actions; 'install', 'enable' and 'authorize' are MCP actions. A target the other side owns is refused with the call that does work. Hosted actions: 'display' (desktop app) shows the user a card with every connector, most used apps first, clicking one starts its sign-in, and waits until they press Continue or 300 s pass; slugs in 'connectors' are pinned at the top as Suggested. It returns connected, newly_connected and suggested slugs, or 'said' when the user typed an answer instead, or timed_out. Use it when the user wants to browse apps; use 'connect' when they name one. Outside the desktop app it returns the status list. 'status' lists connectors and whether each is connected; 'connect' starts an authorization for the given connectors; 'reconnect' checks each one and repairs only what is not connected ('force': true restarts even a working one, for an account switch). A second account of one app is 'connect' with a new 'alias': pick a short lowercase name from the user's words (e.g. 'work'), and ask the user if unsure. 'status' lists each connector's accounts; 'rename' names or renames one. Pass SEVERAL slugs in one call. In the desktop app, the terminal UI and the interactive CLI the call shows the user a card and blocks until every app is connected, skipped, or the deadline passes; the result lists each target as connected / skipped / not_connected and never carries a link. Where no card exists (a one-shot run, a scheduled job, a messaging platform) the result carries a connect_url per app for the USER to open in a browser (never open it yourself); ask them to say when they are done, then use 'status'. When a hosted connector tool call returns CONNECTION_REQUIRED, use 'connect'. MCP actions (every target must carry \"mcp\": true): 'install' adds a catalog entry, 'enable' re-enables a disabled configured server, 'authorize' runs its OAuth. They show the user an approval card and block until it settles. Never hand-edit mcp_servers config — always use this tool. After a skip or a timeout, do not re-ask on your own: continue without the app or ask in chat. A later request from the USER for that same app is not a re-ask — run it. A connected server's tools are named in the result and are callable at once through tool_describe/tool_call. Where no card exists an MCP target runs at once and the result says what happened, with a link for the user to open when one is needed. This tool can NOT disconnect, delete, or revoke an account — that is deliberately user-only. When asked, say so and direct the user to the Nous Portal (their org's Connectors page) or the desktop app.",
"name": "manage_connections",
"parameters": {
"properties": {
"action": {
- "description": "Defaults to status. connect, reconnect and rename take hosted connector slugs only. install, enable and authorize take mcp:true targets only.",
+ "description": "Defaults to status. display, connect, reconnect and rename take hosted connector slugs only. install, enable and authorize take mcp:true targets only.",
"enum": [
+ "display",
"status",
"connect",
"reconnect",
@@ -17,7 +18,7 @@
"type": "string"
},
"connectors": {
- "description": "Targets. REQUIRED for every action but status (e.g. [\"gmail\", {\"name\": \"linear\", \"mcp\": true}]); optional filter for status. A bare slug is a hosted connector, so an MCP server needs the object form with \"mcp\": true.",
+ "description": "Targets. REQUIRED for every action but status and display (e.g. [\"gmail\", {\"name\": \"linear\", \"mcp\": true}]); optional filter for status and the Suggested rows for display. A bare slug is a hosted connector, so an MCP server needs the object form with \"mcp\": true.",
"items": {
"anyOf": [
{
diff --git a/tests/tools/test_connectors_display.py b/tests/tools/test_connectors_display.py
new file mode 100644
index 00000000000..cf4570b332d
--- /dev/null
+++ b/tests/tools/test_connectors_display.py
@@ -0,0 +1,67 @@
+"""``manage_connections`` action ``display``: the desktop directory card.
+
+Contracts:
+- on desktop the call emits a card with no targets, waits for Continue, and reports what is connected,
+ computed from the gateway list read at the start and at settle
+- without a card surface it returns at once with the status list and where to connect
+"""
+
+import json
+import threading
+
+import pytest
+
+from tools.connectors import live
+from tools.connectors.run import apply_answer
+from tools.connectors.tool import manage_connections
+
+
[email protected](autouse=True)
+def _clean_live():
+ live.reset_for_tests()
+ yield
+ live.reset_for_tests()
+
+
+class ListFake:
+ def __init__(self, connected):
+ self.connected = set(connected)
+
+ def list_connectors(self, *, timeout=None):
+ return [{"connector": s, "connected": s in self.connected} for s in ("gmail", "linear", "slack")]
+
+
+def _display(gw, *, callback, card_surface):
+ return json.loads(manage_connections(
+ {"action": "display", "connectors": ["slack", "linear"]}, client_factory=lambda: gw,
+ connection_callback=callback, card_surface=card_surface, session_id="s1",
+ ))
+
+
+def test_display_waits_for_continue_and_reports_what_the_user_connected():
+ gw = ListFake({"gmail"})
+ seen = []
+
+ def card(payload):
+ seen.append(payload)
+
+ def user_connects_slack_then_continues():
+ gw.connected.add("slack")
+ apply_answer(live.get("s1", payload["op_id"]), json.dumps({"settled_by": "continue"}))
+
+ threading.Timer(0.05, user_connects_slack_then_continues).start()
+
+ out = _display(gw, callback=card, card_surface=True)
+
+ (payload,) = seen
+ assert payload["targets"] == [] and payload["display"] == {"suggested": ["slack", "linear"]}
+ assert out == {"connected": ["gmail", "slack"], "newly_connected": ["slack"], "suggested": ["slack", "linear"]}
+ assert live.current("s1") is None
+
+
+def test_display_without_a_card_returns_the_status_list_at_once():
+ out = _display(ListFake({"gmail"}), callback=lambda _payload: None, card_surface=False)
+
+ assert {row["connector"]: row["connected"] for row in out["connectors"]}["gmail"] is True
+ assert "desktop app" in out["note"]
+ assert live.current("s1") is None
diff --git a/tools/connectors/display.py b/tools/connectors/display.py
new file mode 100644
index 00000000000..aa232454ce5
--- /dev/null
+++ b/tools/connectors/display.py
@@ -0,0 +1,67 @@
+"""``manage_connections`` action ``display``: the desktop's browsable connector card.
+
+The card is an operation with no targets, so only Continue, a typed answer, the deadline or /stop
+settles it. Connecting from the card runs the Connectors page's own account operation, never this one."""
+
+from __future__ import annotations
+
+import json
+from dataclasses import dataclass, field
+from typing import Any, Optional
+
+from tools.connectors.contract import SettleReason
+from tools.connectors.operation import ConnectionOperation
+from tools.connectors.run import Callback, Kind, open_and_drive
+
+OFF_DESKTOP_NOTE = (
+ "The connector card shows only in the Hermes desktop app. Tell the user to connect apps from the "
+ "desktop app or the portal."
+)
+
+
+@dataclass
+class DisplayOperation(ConnectionOperation):
+ suggested: list[str] = field(default_factory=list)
+ # The user's typed words when they answered the card in the composer instead of pressing Continue.
+ said: Optional[str] = None
+
+ def request_payload(self) -> dict[str, Any]:
+ return {**super().request_payload(), "display": {"suggested": list(self.suggested)}}
+
+
+def apply_answer(operation: DisplayOperation, raw: str) -> None:
+ answer = json.loads(raw)
+ said = answer.get("said")
+ if said:
+ operation.said = str(said)
+ if said or answer.get("settled_by") == SettleReason.continue_.value:
+ operation.settle(SettleReason.continue_)
+
+
+def connected_slugs(client: Any) -> set[str]:
+ return {str(i.get("connector", "")).lower() for i in client.list_connectors()
+ if isinstance(i, dict) and i.get("connected")}
+
+
+def _result(client: Any, before: set[str], operation: DisplayOperation) -> dict[str, Any]:
+ if operation.settled_by == SettleReason.deadline:
+ return {"timed_out": True}
+ if operation.settled_by == SettleReason.continue_ and operation.said is not None:
+ return {"said": operation.said}
+ after = connected_slugs(client)
+ return {"connected": sorted(after), "newly_connected": sorted(after - before), "suggested": operation.suggested}
+
+
+def _unchanged(_operation: Any) -> None:
+ return None
+
+
+def run_display(client: Any, suggested: list[str], *, session_key: str, tool_call_id: Optional[str],
+ connection_callback: Callback, call: Optional[Any] = None) -> str:
+ """Draw the card and hold the tool thread until it settles."""
+ before = connected_slugs(client)
+ operation = DisplayOperation([], session_key=session_key, tool_call_id=tool_call_id, call=call,
+ suggested=suggested)
+ kind = Kind(prepare=_unchanged, observe=_unchanged, note="",
+ result=lambda _settled: _result(client, before, operation))
+ return open_and_drive(operation, kind, connection_callback=connection_callback, with_urls_in_result=False)
diff --git a/tools/connectors/managed.py b/tools/connectors/managed.py
index 9b5e8345c47..2b33837d1a4 100644
--- a/tools/connectors/managed.py
+++ b/tools/connectors/managed.py
@@ -324,6 +324,17 @@ def _status_result(client: Any, connectors: list[str]) -> str:
"replaced by a reconnect and is kept only for the record.")}, ensure_ascii=False)
+def _display_result(client: Any, suggested: list[str], *, session_id: Optional[str], tool_call_id: Optional[str],
+ connection_callback: Optional[Callable[[dict[str, Any]], Optional[str]]], call: Any) -> str:
+ """The desktop card when one can draw; elsewhere the status list and where to connect."""
+ from tools.connectors.display import OFF_DESKTOP_NOTE, run_display
+
+ if connection_callback is None:
+ return json.dumps({**json.loads(_status_result(client, [])), "note": OFF_DESKTOP_NOTE}, ensure_ascii=False)
+ return run_display(client, suggested, session_key=operation_session_key(session_id), tool_call_id=tool_call_id,
+ connection_callback=connection_callback, call=call)
+
+
def _rename_result(target: HostedTarget) -> str:
"""Rename the one account of ``target.name`` called ``target.alias`` (or, when unnamed, labelled
so) to ``target.to``. Synchronous: no operation and no card."""
@@ -367,6 +378,7 @@ def run_managed_action(
turn_id: Optional[str] = None,
connection_callback: Optional[Callable[[dict[str, Any]], Optional[str]]] = None,
connectors_available: Optional[Callable[[], bool]] = None,
+ card_surface: bool = False,
) -> str:
from tools.managed_gateway_identity import CallRef
@@ -377,6 +389,9 @@ def run_managed_action(
return _rename_result(targets[0])
call = CallRef(turn_id=turn_id, tool_call_id=tool_call_id)
client = client_factory() if client_factory else managed_client(call=call)
+ if action == "display":
+ return _display_result(client, [t.name for t in targets], session_id=session_id, tool_call_id=tool_call_id,
+ connection_callback=connection_callback if card_surface else None, call=call)
if action == "status":
return _status_result(client, [t.name for t in targets])
if not targets:
diff --git a/tools/connectors/run.py b/tools/connectors/run.py
index 2e6e09bbdf1..0f3182b53f5 100644
--- a/tools/connectors/run.py
+++ b/tools/connectors/run.py
@@ -39,6 +39,8 @@ class Kind:
prepare: Callable[[ConnectionOperation], None]
observe: Callable[[ConnectionOperation], None]
note: str
+ # Replaces the per-target result for an operation the model reads differently (the display card).
+ result: Optional[Callable[[ConnectionOperation], dict[str, Any]]] = None
def reissue(operation: ConnectionOperation, names: Sequence[str], *, initiator: Optional[str] = None) -> Optional[str]:
@@ -72,8 +74,11 @@ def reissue(operation: ConnectionOperation, names: Sequence[str], *, initiator:
def apply_answer(operation: ConnectionOperation, raw: str) -> None:
"""Hand the card's answer to the module running this operation (a catalog install or an MCP
one); a managed operation's card only skips and continues, which the MCP fold also covers."""
- from tools.connectors import catalog, mcp
+ from tools.connectors import catalog, display, mcp
+ if isinstance(operation, display.DisplayOperation):
+ display.apply_answer(operation, raw)
+ return
(catalog.apply_answer if catalog.owns(operation.op_id) else mcp.apply_answer)(operation, raw)
@@ -89,7 +94,24 @@ def run_operation(
call: Optional[Any] = None,
) -> str:
"""Block the tool thread until the operation settles; return the tool's JSON string."""
- operation = ConnectionOperation(targets, session_key=session_key, tool_call_id=tool_call_id, call=call)
+ return open_and_drive(
+ ConnectionOperation(targets, session_key=session_key, tool_call_id=tool_call_id, call=call),
+ kind,
+ connection_callback=connection_callback,
+ tick_seconds=tick_seconds,
+ with_urls_in_result=with_urls_in_result,
+ )
+
+
+def open_and_drive(
+ operation: ConnectionOperation,
+ kind: Kind,
+ *,
+ connection_callback: Optional[Callback],
+ tick_seconds: Optional[float] = None,
+ with_urls_in_result: bool,
+) -> str:
+ """Register ``operation`` as the session's open one and drive it; one open per session."""
try:
live.open(operation)
except live.OperationAlreadyOpen as exc:
@@ -124,6 +146,8 @@ def drive_operation(
_watch(operation, kind, tick_seconds)
finally:
live.close(operation)
+ if kind.result is not None:
+ return json.dumps(kind.result(operation), ensure_ascii=False)
payload = operation.result(with_urls=with_urls_in_result)
payload["status"] = "settled"
payload["note"] = kind.note
diff --git a/tools/connectors/targets.py b/tools/connectors/targets.py
index 0be988a3d3c..de7232c3bd0 100644
--- a/tools/connectors/targets.py
+++ b/tools/connectors/targets.py
@@ -7,7 +7,7 @@ from typing import Any, List, Optional, Set, Tuple
logger = logging.getLogger(__name__)
-CONNECTOR_ACTIONS = ("status", "connect", "reconnect", "rename")
+CONNECTOR_ACTIONS = ("display", "status", "connect", "reconnect", "rename")
MCP_ACTIONS = ("install", "enable", "authorize")
ALL_ACTIONS = CONNECTOR_ACTIONS + MCP_ACTIONS
@@ -105,6 +105,8 @@ def validate_action(action: str, managed: list[HostedTarget], mcp: list[str]) ->
def _validate_accounts(action: str, managed: list[HostedTarget]) -> Optional[str]:
if action != "rename" and any(t.to for t in managed):
return "'to' is the new name of an account and applies to action rename only."
+ if action == "display" and any(t.alias for t in managed):
+ return "display takes connector slugs to suggest (e.g. [\"gmail\"]); accounts are named on connect."
if action == "rename":
if len(managed) != 1 or not managed[0].alias or not managed[0].to:
return ("rename takes exactly one target {\"name\": \"<slug>\", \"alias\": \"<current name>\", "
diff --git a/tools/connectors/tool.py b/tools/connectors/tool.py
index b916a96d3a4..97fe83fb0f6 100644
--- a/tools/connectors/tool.py
+++ b/tools/connectors/tool.py
@@ -24,6 +24,7 @@ def manage_connections(
turn_id: Optional[str] = None,
connection_callback: Optional[Callable[[dict[str, Any]], Optional[str]]] = None,
connectors_available: Optional[Callable[[], bool]] = None,
+ card_surface: bool = False,
) -> str:
action = str(args.get("action") or "status").strip().lower()
managed, mcp_targets, target_error = normalize_targets(args.get("connectors"))
@@ -43,6 +44,7 @@ def manage_connections(
action, managed, args,
client_factory=client_factory, session_id=session_id, tool_call_id=tool_call_id, turn_id=turn_id,
connection_callback=connection_callback, connectors_available=connectors_available,
+ card_surface=card_surface,
)
@@ -58,7 +60,12 @@ MANAGE_CONNECTIONS_SCHEMA = {
"catalog entry; otherwise the target is hosted. 'connect' and 'reconnect' are hosted "
"actions; 'install', 'enable' and 'authorize' are MCP actions. A target the other side "
"owns is refused with the call that does work. "
- "Hosted actions: 'status' lists connectors and whether each is connected; 'connect' "
+ "Hosted actions: 'display' (desktop app) shows the user a card with every connector, most used apps "
+ "first, clicking one starts its sign-in, and waits until they press Continue or 300 s pass; slugs in "
+ "'connectors' are pinned at the top as Suggested. It returns connected, newly_connected and "
+ "suggested slugs, or 'said' when the user typed an answer instead, or timed_out. Use it when the "
+ "user wants to browse apps; use 'connect' when they name one. Outside the desktop app it returns "
+ "the status list. 'status' lists connectors and whether each is connected; 'connect' "
"starts an authorization for the given connectors; 'reconnect' checks each one and "
"repairs only what is not connected ('force': true restarts even a working one, for an "
"account switch). A second account of one app is 'connect' with a new 'alias': pick a short "
@@ -89,7 +96,7 @@ MANAGE_CONNECTIONS_SCHEMA = {
"type": "string",
"enum": list(ALL_ACTIONS),
"description": (
- "Defaults to status. connect, reconnect and rename take hosted connector slugs only. "
+ "Defaults to status. display, connect, reconnect and rename take hosted connector slugs only. "
"install, enable and authorize take mcp:true targets only."
),
},
@@ -129,9 +136,9 @@ MANAGE_CONNECTIONS_SCHEMA = {
]
},
"description": (
- "Targets. REQUIRED for every action but status "
+ "Targets. REQUIRED for every action but status and display "
"(e.g. [\"gmail\", {\"name\": \"linear\", \"mcp\": true}]); optional filter for "
- "status. A bare slug is a hosted connector, so an MCP server needs the object "
+ "status and the Suggested rows for display. A bare slug is a hosted connector, so an MCP server needs the object "
"form with \"mcp\": true."
),
},
diff --git a/tui_gateway/contracts/connectors_operation.py b/tui_gateway/contracts/connectors_operation.py
index 98a2f9d86d3..1efa8a595e6 100644
--- a/tui_gateway/contracts/connectors_operation.py
+++ b/tui_gateway/contracts/connectors_operation.py
@@ -168,6 +168,12 @@ class ConnectionOperationTarget(Payload):
already_installed: bool | None = None
+class ConnectionDisplay(Payload):
+ """``manage_connections`` action ``display``: the directory card, with these slugs pinned as Suggested."""
+
+ suggested: list[str]
+
+
class ConnectionRequestPayload(Payload):
"""``ConnectionOperation.request_payload``: opens the card; also the ``pending_connection`` resume
snapshot so a client that missed the event restores the card with the server's deadline."""
@@ -181,6 +187,8 @@ class ConnectionRequestPayload(Payload):
targets: list[ConnectionOperationTarget]
# The model's id for the call that opened the operation; the card binds to that tool row only.
tool_call_id: str | None = None
+ # Present on a display operation, which has no targets.
+ display: ConnectionDisplay | None = None
event("connection.request", ConnectionRequestPayload,
@@ -254,6 +262,8 @@ class ConnectionAnswer(Params):
targets: list[ConnectionAnswerTarget] = Field(default_factory=list)
settled_by: ConnectionSettleReason | None = None
+ # A display card answered by the user's typed words; it settles the card like Continue.
+ said: str | None = None
class ConnectionRespondParams(ConnectionOperationParams):
diff --git a/website/docs/reference/tools-reference.md b/website/docs/reference/tools-reference.md
index 6ea9f9f7fc4..863c1d851d9 100644
--- a/website/docs/reference/tools-reference.md
+++ b/website/docs/reference/tools-reference.md
@@ -64,7 +64,7 @@ One tool for both kinds of external app. A target is a managed connector (`"gmai
| Tool | Description | Requires environment |
|------|-------------|----------------------|
-| `manage_connections` | Managed actions: `status` (each connector lists its `accounts`: alias, label, status, active), `connect`, `reconnect` (repairs only what is not connected; `force: true` restarts a working one), `rename`. A connect or reconnect target may carry an account name (`{"name": "gmail", "alias": "work"}`): connect with a new name adds another account, and reconnect with a name repairs only that account and deletes nothing. `rename` takes one target, `{"name": "gmail", "alias": "work", "to": "office"}`; `alias` may be the app label of an unnamed account. MCP actions, for `mcp: true` targets only: `install` a catalog entry, `enable` a disabled configured server, `authorize` (OAuth). In the desktop app, the terminal UI and the classic CLI every action shows a card and blocks until each target is connected, skipped, or the 300-second deadline passes; the result lists targets as `connected`, `skipped` or `not_connected` and carries no link. An MCP `install` collects the entry's setup values in the card, runs the entry's OAuth from the card when it has one (the user opens the link; nothing opens by itself), and saves configuration, tokens and values together when the server accepts the token. A connected MCP target carries `tools` (the registered names) and `tools_listing`, and those tools are callable through `tool_describe`/`tool_call` in the same turn. A target with `discovery_error` is authorized but its tools could not be listed; call `install` or `authorize` for it again to retry discovery without new consent. On surfaces with no card (messaging, scripted dispatch) managed targets return a `connect_url` per app for the user to open, and an MCP target runs at once: `authorize` and an OAuth `install` return the authorization URL, other installs and `enable` report the outcome, and a missing credential comes back as `failed` naming the variable to set. Cannot disconnect, remove or revoke an account; the user does that. | — |
+| `manage_connections` | Managed actions: `display` (desktop app only: a card of every hosted connector, most used apps first, where clicking an app starts its sign-in; any `connectors` slugs are pinned at the top as Suggested; it waits until the user presses Continue or 300 seconds pass and returns `connected`, `newly_connected` and `suggested` slugs, `said` when the user typed an answer instead, or `timed_out`; on other surfaces it returns the `status` list and tells the user to connect from the desktop app or the portal), `status` (each connector lists its `accounts`: alias, label, status, active), `connect`, `reconnect` (repairs only what is not connected; `force: true` restarts a working one), `rename`. A connect or reconnect target may carry an account name (`{"name": "gmail", "alias": "work"}`): connect with a new name adds another account, and reconnect with a name repairs only that account and deletes nothing. `rename` takes one target, `{"name": "gmail", "alias": "work", "to": "office"}`; `alias` may be the app label of an unnamed account. MCP actions, for `mcp: true` targets only: `install` a catalog entry, `enable` a disabled configured server, `authorize` (OAuth). In the desktop app, the terminal UI and the classic CLI every action shows a card and blocks until each target is connected, skipped, or the 300-second deadline passes; the result lists targets as `connected`, `skipped` or `not_connected` and carries no link. An MCP `install` collects the entry's setup values in the card, runs the entry's OAuth from the card when it has one (the user opens the link; nothing opens by itself), and saves configuration, tokens and values together when the server accepts the token. A connected MCP target carries `tools` (the registered names) and `tools_listing`, and those tools are callable through `tool_describe`/`tool_call` in the same turn. A target with `discovery_error` is authorized but its tools could not be listed; call `install` or `authorize` for it again to retry discovery without new consent. On surfaces with no card (messaging, scripted dispatch) managed targets return a `connect_url` per app for the user to open, and an MCP target runs at once: `authorize` and an OAuth `install` return the authorization URL, other installs and `enable` report the outcome, and a missing credential comes back as `failed` naming the variable to set. Cannot disconnect, remove or revoke an account; the user does that. | — |
The deadline for one call is five minutes, fixed by the backend when the call starts;
reopening the chat or restarting the desktop never extends it. The tool is present only when the