Skip to main content
Glama

disconnect

Terminate the active TN5250 session to disconnect from the IBM i system.

Instructions

Disconnect the active TN5250 session.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool handler for 'disconnect' — a decorated @mcp.tool() function that disconnects the active TN5250 session. It checks if _session exists, calls await _session.disconnect(), sets _session = None, and returns a status dict.
    async def disconnect() -> dict:
        """Disconnect the active TN5250 session."""
        global _session
    
        if _session is None:
            return {"status": "already disconnected"}
    
        await _session.disconnect()
        _session = None
        return {"status": "disconnected"}
  • The tool is registered via the @mcp.tool() decorator on the disconnect() function in server.py. The FastMCP instance 'mcp' automatically registers it.
    @mcp.tool()
  • Tn5250Session.disconnect() — the session-level helper method that closes the TelnetStream, sets the state to DISCONNECTED, and clears the screen buffer.
    async def disconnect(self) -> None:
        await self._stream.close()
        self._state = SessionState.DISCONNECTED
        self._screen.clear()
  • The SessionState enum defining the 'disconnected' state constant used by the disconnect logic.
    class SessionState(Enum):
        DISCONNECTED = "disconnected"
        NEGOTIATING = "negotiating"
        CONNECTED = "connected"
        WAITING = "waiting"
Behavior3/5

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

No annotations are provided, so the description carries the full burden. 'Disconnect' is generally understood as terminating a session, but it does not disclose any side effects (e.g., unsaved data loss) or whether it can be called multiple times safely. Adequate but could be more transparent.

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

Conciseness5/5

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

The description is a single, well-structured sentence with no extraneous information. Every word is necessary and efficiently conveys the action.

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?

Given the simplicity of the tool (no parameters, no output schema), the description is fairly complete. It could be improved by noting that it only works when a session is active, but the context of a terminal emulator makes that implicit.

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?

The tool has zero parameters, and the schema coverage is 100%. According to guidelines, baseline is 4 for no parameters. The description adds no param info, which is acceptable as there is nothing to document.

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?

The description clearly states the verb 'Disconnect' and the resource 'active TN5250 session', making the tool's purpose unambiguous. It effectively distinguishes itself from siblings like 'connect' and terminal interaction tools.

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

Usage Guidelines3/5

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

The description implies usage when connected, but does not explicitly state when to use vs. alternatives or prerequisites like being connected. No guidance on when not to use.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/WhitehornLtd/ibmi-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server