Skip to main content
Glama
nickgnd

Tmux MCP Server

by nickgnd

kill-pane

Terminate a specific tmux pane by its ID to remove unused terminal windows and manage session resources.

Instructions

Kill a tmux pane by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paneIdYesID of the tmux pane to kill

Implementation Reference

  • The handler function for the "kill-pane" MCP tool. It takes a paneId parameter, calls the tmux.killPane helper, and returns a success or error message.
    async ({ paneId }) => {
      try {
        await tmux.killPane(paneId);
        return {
          content: [{
            type: "text",
            text: `Pane ${paneId} has been killed`
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: "text",
            text: `Error killing pane: ${error}`
          }],
          isError: true
        };
      }
    }
  • Input schema for the "kill-pane" tool using Zod to validate the paneId parameter.
    {
      paneId: z.string().describe("ID of the tmux pane to kill")
    },
  • src/index.ts:287-312 (registration)
    Registration of the "kill-pane" tool with the MCP server, including name, description, input schema, and handler function.
    server.tool(
      "kill-pane",
      "Kill a tmux pane by ID",
      {
        paneId: z.string().describe("ID of the tmux pane to kill")
      },
      async ({ paneId }) => {
        try {
          await tmux.killPane(paneId);
          return {
            content: [{
              type: "text",
              text: `Pane ${paneId} has been killed`
            }]
          };
        } catch (error) {
          return {
            content: [{
              type: "text",
              text: `Error killing pane: ${error}`
            }],
            isError: true
          };
        }
      }
    );
  • Helper function tmux.killPane that executes the actual tmux 'kill-pane' command using executeTmux.
    export async function killPane(paneId: string): Promise<void> {
      await executeTmux(`kill-pane -t '${paneId}'`);
    }

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/nickgnd/tmux-mcp'

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