LibTmuxMCP 0.1.0-alpha.5 · Source
Connect the server using the setup guide, then call
list_sessions from your MCP client.
List sessionsLink to section
This is the params object for an MCP tools/call request. Send it
through the connected client:
{ "name": "list_sessions", "arguments": {}}Use the returned session IDs when choosing a window or pane. The tool reference describes this port’s result and optional arguments.
InternalsLink to section
The following examples are for applications that embed or extend the server. Installing and connecting an MCP client does not require this code.
The Swift example package uses the public
LibTmuxMCP
product directly.
It demonstrates the default readonly surface and an exact typed
selection without launching a stdio subprocess.
Embed the tool surfaceLink to section
import LibTmuximport LibTmuxMCP
public func useEmbeddedTools(on server: Server) async throws(ToolError) -> Int { let tools = TmuxTools(server: server) for definition in tools.visibleDefinitions { print(definition.name, definition.summary) } let result = try await tools.call(ToolCall(name: "list_panes")) return result.structured["panes"]?.arrayValue?.count ?? 0}
public func useExactEmbeddedTools(on server: Server) -> TmuxTools { let authority = ToolAuthority( toolsets: [], includedTools: ["create_window", "list_sessions"] ) let tools = TmuxTools(server: server, authority: authority) return tools}The first function lists visible definitions and calls list_panes.
The caller supplies the existing Server and retains its lifetime.
The second function starts with no toolsets and includes only its named
operations. It does not include future tools automatically.
Run its testsLink to section
From the Swift repository with its toolchain and tmux installed:
$ swift test \ --package-path Examples \ --filter MCPEmbeddingTestsThe example tests use a tmux fixture to verify the pane count and exact offered names. Rendering the source does not run that test.
The example source is also the basis for the library’s embedding documentation.
Use Workspace builder examples for direct workspace construction; the MCP catalog has no workspace-file operation.