Repository navigation
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
#149 makes kill_session ask the user before killing, when the client supports MCP elicitation. kill_window, kill_pane and kill_server still kill without asking, so the confirmation covers one of the four kill tools.
Motivation
Each of these ends processes the user may care about: every pane in a window, the process in a pane, or every session on a server. A user who sees kill_session ask would expect the others to ask too.
Proposal
Move the confirmation from session_tools.py into _utils.py as one helper, _ask_before_teardown(ctx, question, declined=..., identity=...), and call it from all four tools. A local spike did this.
- Questions name what the user would lose: the window's name, the command running in the pane, and the server's socket and session count.
- The target's identity is
#{pid}:#{start_time}:<id>, using#{window_id}or#{pane_id}, and plain#{pid}:#{start_time}for the server. tmux numbers sessions, windows and panes from process-global counters that restart at zero with each server (session.c,window.cat 3.8). So an id alone can name a new object after a restart.start_timehas one-second resolution, andpidseparates two servers started in the same second. display-message -p '#{pid}:#{start_time}'works on a server with no attached client, sokill_servercan carry an identity too.- The tools become
asyncand take aContext. fastmcp hidesctxfrom the input schema and dropsInputRequiredResultfrom the output schema, so the tool-surface snapshot showed no change for the three tools. - Tests: accept, decline, and a client without elicitation, for each tool on 2025-11-25 and 2026-07-28. Existing tests that call these tools directly need
asyncio.run.
The delete_buffer and clear_pane tools also sit in the teardown toolset; whether they should ask is a separate question.
References
- mcp(feat): Confirm kill_session, add pane viewer and icons #149 adds the confirmation to
kill_session - tmux
session.csession-id counter at 3.8 - tmux
window.cwindow and pane id counters at 3.8
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Activity
mcp(feat[teardown]): Ask before every kill tool
mcp(feat[teardown]): Ask before every kill tool (#154)