Utilities

Shared utilities for libtmux MCP server.

Provides server caching, object resolution, serialization, and error handling for all MCP tool functions.

libtmux_mcp._utils.handle_tool_errors(fn)[source]

Decorate MCP tool functions with standardized error handling.

Catches libtmux exceptions and re-raises as ToolError so that MCP responses have isError=True with a descriptive message.

Return type:

Callable[[ParamSpec(P, bound= None)], TypeVar(R)]

Parameters:

fn (Callable[[~P], R])