Skip to content

Ask before kill_window, kill_pane and kill_server #152

Closed

Description

@tony

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.c at 3.8). So an id alone can name a new object after a restart. start_time has one-second resolution, and pid separates two servers started in the same second.
  • display-message -p '#{pid}:#{start_time}' works on a server with no attached client, so kill_server can carry an identity too.
  • The tools become async and take a Context. fastmcp hides ctx from the input schema and drops InputRequiredResult from 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

Activity

  1. added a commit that references this issue on Nov 7, 2026
    8ea554f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions