split_pane
Split an iTerm2 session pane horizontally or vertically, with optional profile and command for the new pane.
Instructions
Split an iTerm2 pane horizontally or vertically.
:param session_id: Session UUID to split. Defaults to the active session. :param vertical: If True, split left/right; if False, split top/bottom. :param profile: Name of the iTerm2 profile to use for the new pane. :param command: Optional command to run in the new pane after the split.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | No | ||
| vertical | No | ||
| profile | No | ||
| command | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/iterm2_mcp/server.py:325-344 (handler)The split_pane tool handler function. It resolves a session (defaulting to the active one), calls async_split_pane on it with the vertical and profile parameters, optionally sends a command to the new pane, and returns a success/error message.
async def split_pane( session_id: str | None = None, vertical: bool = True, profile: str | None = None, command: str | None = None, ) -> str: """Split an iTerm2 pane horizontally or vertically. :param session_id: Session UUID to split. Defaults to the active session. :param vertical: If True, split left/right; if False, split top/bottom. :param profile: Name of the iTerm2 profile to use for the new pane. :param command: Optional command to run in the new pane after the split. """ sess = await _session(session_id) new_sess = await sess.async_split_pane(vertical=vertical, profile=profile) if new_sess is None: return "Error: failed to split pane." if command: await new_sess.async_send_text(command + "\n", suppress_broadcast=True) return f"Split created session {new_sess.session_id}" - src/iterm2_mcp/server.py:324-324 (registration)The @mcp.tool() decorator that registers split_pane as an MCP tool.
@mcp.tool() - src/iterm2_mcp/server.py:325-331 (schema)The function signature and docstring serve as the input schema (session_id, vertical, profile, command parameters).
async def split_pane( session_id: str | None = None, vertical: bool = True, profile: str | None = None, command: str | None = None, ) -> str: """Split an iTerm2 pane horizontally or vertically.