Manage existing PTY sessions including listing, inspecting, controlling, and terminating active terminal sessions. Provides comprehensive session lifecycle management capabilities.

**!! ESSENTIAL TOOL FOR PROPER SESSION MANAGEMENT !!**

**THIS TOOL IS MANDATORY FOR PROPER SESSION MANAGEMENT**

Supported actions:
- list: Show all active PTY sessions
- get: Get detailed information about a specific session
- resize: Change terminal dimensions for a session
- write: Send input/data to an active session
- close: Terminate a session gracefully

Key capabilities:
- Session inventory and monitoring
- Real-time session inspection
- Dynamic terminal resizing
- Interactive session control
- Resource cleanup and management

Usage patterns:
- Monitor running sessions: pty_manage { "action": "list" }
- Inspect specific session: pty_manage { "action": "get", "sessionId": "session-id" }
- Adjust terminal size: pty_manage { "action": "resize", "sessionId": "id", "cols": 120, "rows": 40 }
- Send commands to session: pty_manage { "action": "write", "sessionId": "id", "data": "ls -la\n" }
- Clean up sessions: pty_manage { "action": "close", "sessionId": "id" }

Parameters:
- action (required): Management operation to perform (list, get, resize, write, close)
- sessionId (required for get/resize/write/close): Target session identifier
- cols/rows (required for resize): New terminal dimensions
- data (required for write): Data/input to send to session

**!! CRITICAL RESOURCE CLEANUP REQUIREMENTS !!**

**WARNING**: PTY sessions PERSIST in background and consume system resources!

**IMPERATIVE ACTIONS**:
1. **ALWAYS** use this tool to properly terminate UNUSED sessions
2. **SESSIONS persist in background** and consume CPU, memory, file descriptors
3. **REGULAR session cleanup prevents SYSTEM RESOURCE EXHAUSTION**
4. **USE "list" action FREQUENTLY** to monitor active sessions
5. **USE "close" action IMMEDIATELY** to properly terminate sessions when done
6. **NEVER leave sessions running unnecessarily** - they do not auto-terminate

**CONSEQUENCES OF POOR RESOURCE MANAGEMENT**:
- System performance degradation
- Resource exhaustion leading to crashes
- Security vulnerabilities from persistent access
- Inability to start new processes
- File descriptor leaks
- System instability

**BEST PRACTICES**:
- Check active sessions before creating new ones
- Close sessions immediately after use
- Monitor session list regularly
- Clean up orphaned sessions promptly

Security: Requires authorization for all management operations.
