MCPconceptTools

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

MoreLess about this notice

Concept example A working example of the core library. It can change without notice. What concept means

tool MCP

swap_pane

Swap the positions of two panes. Change tmux state; no client-supplied executable input.

MCP request method
tools/call Send swap_pane as the tool name, with the arguments below.
Wraps
pane.Pane.swap_withThe library call this tool makes: crates/tmux-mcp/src/tools/contract.rs:834.

Arguments

No other arguments are accepted.

Result

Returns object

  • active (boolean)

    Whether this is the window’s active pane.

  • caller (Relation)

    Whether this is the pane the MCP server itself runs in.

    self only on a confirmed match of both socket and pane id; other for every pane that is not, including one this crate cannot prove either way; unknown when the server is not running inside tmux, so the question has no answer.

  • command (string | null)

    The command currently running.

  • id (string)

    The %-prefixed tmux identity.

  • path (string | null)

    The pane’s working directory.

  • window_id (string)

    The window that contains the pane.

Types

Relation: "unknown" | "self" | "other"

type

How a pane relates to the process answering the request.

Three values rather than a boolean, because “not the caller’s pane” and “there is no caller” are different answers and an agent acts differently on each.

Matches exactly one variant.

  • Variant 1 ("unknown")

    This process is not running inside tmux, so no pane is its own.

  • Variant 2 ("self")

    Confirmed: the same tmux server, and the same pane.

  • Variant 3 ("other")

    Some other pane, or a pane this crate cannot prove is the caller’s.

Annotations

Advertised by the server

destructiveHint
false
idempotentHint
false
openWorldHint
false
readOnlyHint
false
title
"Swap Panes"

Capability

Toolset
Manage Change tmux structure or presentation.
Process reach
none
tmux effects
change

The capability row states what this tool reads, changes and reaches; the annotations are as the server advertises them.

Protocol data

Use the complete advertised contract for validation and client integration.

Input schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"properties": {
"source_pane": {
"description": "The `%`-prefixed pane id to move; the result describes it.",
"type": "string"
},
"target_pane": {
"description": "The `%`-prefixed pane id it trades places with.",
"type": "string"
}
},
"required": [
"source_pane",
"target_pane"
],
"type": "object"
}
Output schema
{
"$defs": {
"Relation": {
"description": "How a pane relates to the process answering the request.\n\nThree values rather than a boolean, because \"not the caller's pane\" and\n\"there is no caller\" are different answers and an agent acts differently on\neach.",
"oneOf": [
{
"const": "unknown",
"description": "This process is not running inside tmux, so no pane is its own.",
"type": "string"
},
{
"const": "self",
"description": "Confirmed: the same tmux server, and the same pane.",
"type": "string"
},
{
"const": "other",
"description": "Some other pane, or a pane this crate cannot prove is the caller's.",
"type": "string"
}
]
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"active": {
"description": "Whether this is the window's active pane.",
"type": "boolean"
},
"caller": {
"$ref": "#/$defs/Relation",
"description": "Whether this is the pane the MCP server itself runs in.\n\n`self` only on a confirmed match of both socket and pane id; `other`\nfor every pane that is not, including one this crate cannot prove\neither way; `unknown` when the server is not running inside tmux, so\nthe question has no answer."
},
"command": {
"description": "The command currently running.",
"type": [
"string",
"null"
]
},
"id": {
"description": "The `%`-prefixed tmux identity.",
"type": "string"
},
"path": {
"description": "The pane's working directory.",
"type": [
"string",
"null"
]
},
"window_id": {
"description": "The window that contains the pane.",
"type": "string"
}
},
"required": [
"id",
"window_id",
"command",
"path",
"active",
"caller"
],
"type": "object"
}
Esc
Search in

Type to search.

Reference previewOpen reference