# libtmux for C# > The C# library (LibTmux). These pages include its guides, tested examples and API documentation. ## C# MCP - [tmux MCP for C#](https://libtmux.org/en/csharp/latest/mcp/): Run LibTmux.Mcp as a .NET tool with bounded results and a selectable tool catalog. - [C# MCP API](https://libtmux.org/en/csharp/latest/mcp/reference/): Find the C# server composition API and current MCP protocol catalog. ## C# Workspace Manager - [C# workspace manager](https://libtmux.org/en/csharp/latest/workspace/): Describe a tmux session in a file, then load, inspect and capture it. ## CLI reference - [Load a workspace](https://libtmux.org/en/csharp/latest/workspace/cli/load/): Create or reuse a session from a workspace file, with explicit attachment and output choices. - [Capture a workspace](https://libtmux.org/en/csharp/latest/workspace/cli/freeze/): Capture a running tmux session as a starting point for a workspace file. - [Convert workspace files](https://libtmux.org/en/csharp/latest/workspace/cli/convert/): Convert a complete workspace document between YAML and JSON. - [Edit a workspace](https://libtmux.org/en/csharp/latest/workspace/cli/edit/): Resolve a workspace file or saved name and open it in an editor. - [Inspect runtime diagnostics](https://libtmux.org/en/csharp/latest/workspace/cli/debug-info/): Collect the workspace CLI runtime, configuration and tmux diagnostics.. - [List saved workspaces](https://libtmux.org/en/csharp/latest/workspace/cli/ls/): List the workspace files found in project and global configuration locations. - [Search workspaces](https://libtmux.org/en/csharp/latest/workspace/cli/search/): Search the fields of discovered workspace documents. - [Evaluate in a workspace](https://libtmux.org/en/csharp/latest/workspace/cli/shell/): Use the optional Python runtime to inspect a workspace through the native command. - [Import a workspace](https://libtmux.org/en/csharp/latest/workspace/cli/import/): Choose a source format and translate it into a workspace document. - [Import from Teamocil](https://libtmux.org/en/csharp/latest/workspace/cli/import-teamocil/): Translate Teamocil windows and pane commands into a workspace document. - [Import from tmuxinator](https://libtmux.org/en/csharp/latest/workspace/cli/import-tmuxinator/): Translate a tmuxinator project into a workspace document. - [tmux-workspace CLI manual](https://libtmux.org/en/csharp/latest/workspace/cli/): Use `tmux-workspace` to load, inspect and save workspace files. - [Shell completion](https://libtmux.org/en/csharp/latest/workspace/cli/completion/): Generate completion for the installed workspace command. ## Concepts - [Concepts](https://libtmux.org/en/csharp/latest/concepts/): tmux objects, command transports, queries, and workspaces. - [Server, session, window, pane](https://libtmux.org/en/csharp/latest/concepts/server-session-window-pane/): How tmux servers, sessions, windows, panes and attached clients relate to each other. - [Control mode vs one-shot](https://libtmux.org/en/csharp/latest/concepts/transports/): Choose subprocesses, command batches, or persistent connections to send commands and receive events. - [Filtering and queries](https://libtmux.org/en/csharp/latest/concepts/queries/): How you get from every session on the server to the one pane you mean, and what happens when zero or several match. - [Workspaces](https://libtmux.org/en/csharp/latest/concepts/workspaces/): Build pane layouts with the object API or a workspace configuration file. ## Configuration - [Workspace configuration](https://libtmux.org/en/csharp/latest/workspace/configuration/): Define the session, windows, panes and commands loaded by the workspace CLI. - [Session configuration](https://libtmux.org/en/csharp/latest/workspace/configuration/session/): Name a workspace and apply session options and environment. - [Window configuration](https://libtmux.org/en/csharp/latest/workspace/configuration/windows/): Set window names, indexes, layouts, options and focus. - [Pane configuration](https://libtmux.org/en/csharp/latest/workspace/configuration/panes/): Choose pane commands, launch settings and focus. - [Workspace commands](https://libtmux.org/en/csharp/latest/workspace/configuration/commands/): Order pane setup and command delivery, Enter handling and delays. - [Workspace environment](https://libtmux.org/en/csharp/latest/workspace/configuration/environment/): Configure the loader process and the variables available to pane commands. - [Files and directories](https://libtmux.org/en/csharp/latest/workspace/configuration/directories/): Resolve saved workspace files and the working directories used by panes. - [Window layouts](https://libtmux.org/en/csharp/latest/workspace/configuration/layouts/): Arrange panes with tmux layout names or a saved layout. - [Bootstrap scripts and extensions](https://libtmux.org/en/csharp/latest/workspace/configuration/hooks/): Run a checked bootstrap process before workspace commands. ## Examples - [Examples](https://libtmux.org/en/csharp/latest/workspace/examples/): Workspace configurations and complete command walkthroughs. - [Examples](https://libtmux.org/en/csharp/latest/examples/): Programs for sending input, capturing output, and building workspaces. - [Attach and send keys](https://libtmux.org/en/csharp/latest/examples/attach-and-send-keys/): Get a session handle, send a command to a pane, and capture output. - [C# MCP examples](https://libtmux.org/en/csharp/latest/mcp/examples/): Run complete C# clients that discover sessions and execute a command in an owned tmux server. - [Capture pane output](https://libtmux.org/en/csharp/latest/examples/capture-pane-output/): Run a complete program that captures a pane and waits for a complete output line. - [List sessions through MCP](https://libtmux.org/en/csharp/latest/mcp/examples/inspect-sessions/): Start an inspection client, verify its tool selection, and read structured session metadata. - [Run a command through MCP](https://libtmux.org/en/csharp/latest/mcp/examples/run-command/): Discover a pane, run a bounded shell command, and check its exit status and captured output. - [Workspace examples](https://libtmux.org/en/csharp/latest/workspace/examples/gallery/): Start from complete configurations for pane layout, commands and environment. ## Guides - [Guides](https://libtmux.org/en/csharp/latest/workspace/guides/): Install the workspace command, find configurations and automate tmux sessions. - [Guides](https://libtmux.org/en/csharp/latest/guides/): Task-oriented walkthroughs that sit between the concepts and each port's own API reference. - [C# MCP guides](https://libtmux.org/en/csharp/latest/mcp/guides/): Install the MCP executable, choose its tmux server, and verify the client's connection. - [Getting started](https://libtmux.org/en/csharp/latest/guides/getting-started/): Run a complete program with this language library. - [Attaching to tmux](https://libtmux.org/en/csharp/latest/guides/attaching-to-tmux/): Connect to an existing tmux server and find a session with C#. - [Sending keys](https://libtmux.org/en/csharp/latest/guides/sending-keys/): Send text and named keys, then wait for the result. - [Capturing output](https://libtmux.org/en/csharp/latest/guides/capturing-output/): Read pane output with an explicit completion condition. - [Querying and filtering](https://libtmux.org/en/csharp/latest/guides/querying-and-filtering/): Choose a target and handle missing or ambiguous results. - [Testing with libtmux](https://libtmux.org/en/csharp/latest/guides/testing-with-libtmux/): Use an isolated server and check cleanup failures. - [Connect an MCP client](https://libtmux.org/en/csharp/latest/mcp/guides/connect-client/): Install the .NET tool, select its tmux endpoint, and verify discovery and ownership. - [Install and load a workspace](https://libtmux.org/en/csharp/latest/workspace/guides/installation/): Build the workspace command and load a session on a private tmux socket. - [Find saved workspaces](https://libtmux.org/en/csharp/latest/workspace/guides/discovery/): Resolve explicit files, project directories and saved workspace names. - [Automate workspace operations](https://libtmux.org/en/csharp/latest/workspace/guides/automation/): Run detached commands with explicit inputs and machine-readable results. - [Export and reload a session](https://libtmux.org/en/csharp/latest/workspace/guides/export-session/): Capture a running session, inspect the document and load a second copy. - [Troubleshoot a workspace](https://libtmux.org/en/csharp/latest/workspace/guides/troubleshooting/): Find the failed stage before retrying a workspace operation. - [Inspect a workspace through MCP](https://libtmux.org/en/csharp/latest/workspace/guides/inspect-with-mcp/): Connect the development C# MCP server to a session loaded by its native workspace CLI. ## Internals - [C# workspace internals](https://libtmux.org/en/csharp/latest/workspace/internals/): Architecture and development interfaces of the C# workspace builder. - [C# workspace builder behavior](https://libtmux.org/en/csharp/latest/workspace/internals/topics/): Internal configuration, application, and failure contracts of the C# workspace builder. - [Use the C# workspace builder](https://libtmux.org/en/csharp/latest/workspace/internals/guides/): Parse a workspace, build it on an owned server, and handle partial failures. - [C# workspace builder examples](https://libtmux.org/en/csharp/latest/workspace/internals/examples/): Internal examples for building and inspecting workspaces through the C# API. - [C# workspace builder API](https://libtmux.org/en/csharp/latest/workspace/reference/): Internal reference for the C# workspace builder and configuration APIs. - [Workspace reference generation](https://libtmux.org/en/csharp/latest/workspace/internals/documentation/): Generate command references from the parser and verify task examples against the CLI. ## Overview - [Third-party notices](https://libtmux.org/en/csharp/latest/third-party-notices/): Thanks to tmux's creator and contributors, with licences and attribution for the software behind libtmux.org. ## Reference - [Exit codes and errors](https://libtmux.org/en/csharp/latest/workspace/reference/exit-codes/): Use process status and structured error codes to handle workspace failures. - [Output formats](https://libtmux.org/en/csharp/latest/workspace/reference/output/): Read JSON results, NDJSON events and diagnostics from the workspace command. - [Runtime and configuration support](https://libtmux.org/en/csharp/latest/workspace/reference/compatibility/): Runtime requirements and configuration boundaries for the C# workspace command. ## Topics - [C# MCP topics](https://libtmux.org/en/csharp/latest/mcp/topics/): Choose callable tools, interpret bounded results, and understand pane observation and cancellation. - [Topics](https://libtmux.org/en/csharp/latest/topics/): Object traversal, cleanup, pane I/O, configuration, and failure handling. - [Architecture](https://libtmux.org/en/csharp/latest/topics/architecture/): Locate operations, distinguish snapshots from live commands, and find their implementation. - [Traversal](https://libtmux.org/en/csharp/latest/topics/traversal/): Moving up and down the server/session/window/pane tree, and the two questions that come up once you have more than one object. - [Ownership and cleanup](https://libtmux.org/en/csharp/latest/topics/context-managers/): Scope-based cleanup for tmux objects, and when your program must kill them explicitly. - [Pane interaction](https://libtmux.org/en/csharp/latest/topics/pane-interaction/): Input defaults, screen capture, and waiting for a command to finish. - [Options and hooks](https://libtmux.org/en/csharp/latest/topics/options-and-hooks/): Read and update tmux options, and register commands for tmux events. - [Format-token fields](https://libtmux.org/en/csharp/latest/topics/format-tokens/): The typed fields every object exposes, mirroring tmux's own format tokens, and why a field is sometimes absent. - [Waiting and retrying](https://libtmux.org/en/csharp/latest/topics/waiting-and-retry/): Polling a condition instead of guessing a sleep, and tmux's own wait-for signal channel as the alternative to polling. - [Environment](https://libtmux.org/en/csharp/latest/topics/environment/): Locate tmux objects from process variables and manage the environment inherited by new panes. - [Socket and servers](https://libtmux.org/en/csharp/latest/topics/socket-and-servers/): Select a server socket, check liveness, and detect a replacement daemon. - [Tool selection](https://libtmux.org/en/csharp/latest/mcp/topics/tool-selection/): Choose the C# MCP server's callable operations and interpret its startup capability report. - [Errors and exceptions](https://libtmux.org/en/csharp/latest/topics/errors-and-exceptions/): Handle command failures, inspect delivery status, and decide when a retry is safe. - [Waits and captured output](https://libtmux.org/en/csharp/latest/mcp/topics/waits-and-output/): Choose command completion or text observation, handle bounded captures, and cancel the right operation. ## Reference - [C# API reference](https://libtmux.org/en/csharp/latest/reference/): every public symbol, generated from the source. Hosted on libtmux.org. ## Optional - [Full documentation text](https://libtmux.org/en/csharp/latest/llms-full.txt): guides and MCP contracts in a single fetch. ## C# MCP tools - [C# MCP tools](https://libtmux.org/en/csharp/latest/mcp/tools/) - [call_read_tools_batch](https://libtmux.org/en/csharp/latest/mcp/tools/call_read_tools_batch/) - [capture_pane](https://libtmux.org/en/csharp/latest/mcp/tools/capture_pane/) - [capture_since](https://libtmux.org/en/csharp/latest/mcp/tools/capture_since/) - [clear_pane_scrollback](https://libtmux.org/en/csharp/latest/mcp/tools/clear_pane_scrollback/) - [create_session](https://libtmux.org/en/csharp/latest/mcp/tools/create_session/) - [create_window](https://libtmux.org/en/csharp/latest/mcp/tools/create_window/) - [find_pane_by_position](https://libtmux.org/en/csharp/latest/mcp/tools/find_pane_by_position/) - [get_pane_info](https://libtmux.org/en/csharp/latest/mcp/tools/get_pane_info/) - [get_server_info](https://libtmux.org/en/csharp/latest/mcp/tools/get_server_info/) - [get_session_info](https://libtmux.org/en/csharp/latest/mcp/tools/get_session_info/) - [get_tmux_variables](https://libtmux.org/en/csharp/latest/mcp/tools/get_tmux_variables/) - [get_window_info](https://libtmux.org/en/csharp/latest/mcp/tools/get_window_info/) - [kill_pane](https://libtmux.org/en/csharp/latest/mcp/tools/kill_pane/) - [kill_session](https://libtmux.org/en/csharp/latest/mcp/tools/kill_session/) - [kill_window](https://libtmux.org/en/csharp/latest/mcp/tools/kill_window/) - [list_panes](https://libtmux.org/en/csharp/latest/mcp/tools/list_panes/) - [list_sessions](https://libtmux.org/en/csharp/latest/mcp/tools/list_sessions/) - [list_windows](https://libtmux.org/en/csharp/latest/mcp/tools/list_windows/) - [move_window](https://libtmux.org/en/csharp/latest/mcp/tools/move_window/) - [paste_text](https://libtmux.org/en/csharp/latest/mcp/tools/paste_text/) - [rename_session](https://libtmux.org/en/csharp/latest/mcp/tools/rename_session/) - [rename_window](https://libtmux.org/en/csharp/latest/mcp/tools/rename_window/) - [resize_pane](https://libtmux.org/en/csharp/latest/mcp/tools/resize_pane/) - [resize_window](https://libtmux.org/en/csharp/latest/mcp/tools/resize_window/) - [respawn_pane](https://libtmux.org/en/csharp/latest/mcp/tools/respawn_pane/) - [run_shell_command](https://libtmux.org/en/csharp/latest/mcp/tools/run_shell_command/) - [search_panes](https://libtmux.org/en/csharp/latest/mcp/tools/search_panes/) - [select_layout](https://libtmux.org/en/csharp/latest/mcp/tools/select_layout/) - [select_pane](https://libtmux.org/en/csharp/latest/mcp/tools/select_pane/) - [select_window](https://libtmux.org/en/csharp/latest/mcp/tools/select_window/) - [send_keys](https://libtmux.org/en/csharp/latest/mcp/tools/send_keys/) - [send_keys_batch](https://libtmux.org/en/csharp/latest/mcp/tools/send_keys_batch/) - [set_history_limit](https://libtmux.org/en/csharp/latest/mcp/tools/set_history_limit/) - [set_mouse_enabled](https://libtmux.org/en/csharp/latest/mcp/tools/set_mouse_enabled/) - [set_pane_title](https://libtmux.org/en/csharp/latest/mcp/tools/set_pane_title/) - [set_synchronize_panes](https://libtmux.org/en/csharp/latest/mcp/tools/set_synchronize_panes/) - [show_environment](https://libtmux.org/en/csharp/latest/mcp/tools/show_environment/) - [show_hooks](https://libtmux.org/en/csharp/latest/mcp/tools/show_hooks/) - [show_option](https://libtmux.org/en/csharp/latest/mcp/tools/show_option/) - [signal_channel](https://libtmux.org/en/csharp/latest/mcp/tools/signal_channel/) - [snapshot_pane](https://libtmux.org/en/csharp/latest/mcp/tools/snapshot_pane/) - [split_window](https://libtmux.org/en/csharp/latest/mcp/tools/split_window/) - [swap_pane](https://libtmux.org/en/csharp/latest/mcp/tools/swap_pane/) - [wait_for_channel](https://libtmux.org/en/csharp/latest/mcp/tools/wait_for_channel/) - [wait_for_text](https://libtmux.org/en/csharp/latest/mcp/tools/wait_for_text/)