Shell MCP Core Principles: Use `exec` for one-off, non-blocking commands.
For operations that require maintaining state or multi-turn interactions
(python/node REPL, gdb, ssh, mysql, wscat, sudo confirmation, reverse shells, etc.),
use the closed loop: `shell_spawn -> shell_send_line -> shell_output|shell_wait_for|shell_snapshot -> shell_close`.
After sending each step, you must use `shell_output|shell_wait_for|shell_snapshot` to confirm the state before deciding on the next step. Do not send commands in batches.
shell_output|shell_wait_for will consume the buffer and return empty when no new content is output to the terminal after repeated use. So you can use shell_snapshot to obtain the full screen content of the current terminal to confirm the session status.
⚠️ Security Guidelines (MUST read guide://shell/security first): All operations of this tool will be audited and recorded; any operation that may adversely affect the user's local machine (destructive commands, privilege escalation, persistent changes, etc.) must be explained to the user to gain explicit consent before execution.
For detailed scenarios, please read_resource: guide://shell/tui,
guide://shell/gdb, guide://shell/ssh, guide://shell/sudo, guide://shell/reverse_shell,
guide://shell/security