Skip to main content
Glama

Sap Session Close

sap_session_close

Close a SAP GUI session and remove it from the registry to manage concurrent logins; attached windows are refused and must be detached instead.

Instructions

Close a SAP session.

Closes the underlying SAP GUI session/tab and removes it from the registry. Any session ID can be closed, including "s1". With the parallel-multi-mandant contract (#671), the registry can hold multiple concurrent logins and you may legitimately want to close any of them — including the lowest-numbered one. If you close the only remaining session, the next tool call will fail with a clear "no session" error and you should call sap_login() again.

Sessions with origin "attached" (a window the user already had open) are never closed by this server: the call is refused and points at sap_session_detach.

Args: session_id: Session to close (e.g. "s1", "s2", ...)

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "session_id": "<session_id>"
    },
    "name": "sap_session_close"
  }
}

Input Schema

NameRequiredDescriptionDefault
session_idYes

Output Schema

NameRequiredDescriptionDefault
errorNoError message if success=False
popupNoPresent when a popup dialog is active on screen
successNoWhether the operation succeeded
session_idNoID of the session that was closed (e.g., 's2')
active_windowNoWhich window was operated on (e.g., 'wnd[0]', 'wnd[1]'). If 'wnd[1]' or higher, a modal dialog is open.
remaining_sessionsNoSessions still active after closing

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full behavioral burden and does well: it discloses the destructive side effect (registry entry removed), the refusal behavior for attached sessions, and the downstream failure mode when the last session is closed. It omits what happens when session_id is unknown or already closed (error vs. silent no-op), which is the main remaining gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core action, then edge cases, then the argument description — a sensible order. It is slightly padded by the issue reference (#671) and by restating the any-session-ID point twice, but no sentence is wasted outright.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter session-lifecycle tool with an output schema available, this covers action, side effects, refusal cases, and recovery paths. Only the invalid-ID behavior and whether the call is idempotent are left unspecified.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0% for the single parameter, so the description must compensate and largely does: it gives format examples ("s1", "s2", ...) and, more valuably, explains that any session ID is a valid target, including the lowest-numbered one under the parallel-multi-mandant contract. It does not say whether an unknown ID returns an error.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ("Close a SAP session") and immediately clarifies the mechanism: it closes the underlying SAP GUI session/tab and removes it from the registry. It also draws the boundary against sap_session_detach, so an agent can distinguish it from the nearest sibling without inspecting either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit when-not guidance (sessions with origin "attached" are refused and the agent should use sap_session_detach) and recovery guidance (if you close the last session, call sap_login again). It also preempts the misconception that the lowest-numbered session is off-limits. It does not address how to choose among release/reset_to_primary-style siblings, but that is not required to call this tool correctly.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.