Sap Session Reset To Primary
sap_session_reset_to_primaryClose every SAP session except the primary s1 to remove orphaned windows and restore a clean state. It reconciles stale registry entries first, then terminates the remaining sessions.
Instructions
Bulk-close every SAP session except the primary one (s1). Use this when parallel agents have left orphaned/extra windows and you want to return to a known-clean state with only s1 open. Reconciles the registry first (drops any sessions that died externally), then closes the rest. WARNING: if you call this from a non-primary session, your own session will be closed and you will appear in killed_agents — your next tool call will fail until you rebind to s1 (or another surviving session) via sap_session_bind. See issue #637 for the parallel-agent drift scenario this addresses.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "sap_session_reset_to_primary"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| error | No | Error message if success=False | |
| popup | No | Present when a popup dialog is active on screen | |
| errors | No | Per-session error strings, one per failed close attempt | |
| success | No | Whether the operation succeeded | |
| active_window | No | Which window was operated on (e.g., 'wnd[0]', 'wnd[1]'). If 'wnd[1]' or higher, a modal dialog is open. | |
| killed_agents | No | Agent IDs whose bound sessions were closed by this reset. These agents must call sap_session_bind on a different session before continuing. | |
| closed_sessions | No | Session IDs that were closed (e.g. ['s2', 's3', 's4']) | |
| skipped_attached | No | Attached (user-owned) session IDs that were deliberately left open. Drop them from the registry with sap_session_detach if no longer needed. | |
| remaining_sessions | No | Session IDs still active after the reset (typically just ['s1']) |