Skip to main content
Glama

create_tab

Open a new iTerm2 tab in a specified window. Optionally run a command or apply a profile.

Instructions

Create a new tab in a window.

:param window_id: Target window ID. Defaults to the current window. :param command: Optional shell command to run in the new tab's session. :param profile: Name of the iTerm2 profile to use.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
window_idNo
commandNo
profileNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The create_tab tool handler: decorated with @mcp.tool(), accepts optional window_id, command, and profile parameters. Looks up the target window (or uses the current terminal window), then calls win.async_create_tab() to create the tab, and returns the new tab ID and session ID.
    @mcp.tool()
    async def create_tab(
        window_id: str | None = None,
        command: str | None = None,
        profile: str | None = None,
    ) -> str:
        """Create a new tab in a window.
    
        :param window_id: Target window ID. Defaults to the current window.
        :param command: Optional shell command to run in the new tab's session.
        :param profile: Name of the iTerm2 profile to use.
        """
        app = await _app()
        if window_id:
            win = next((w for w in app.terminal_windows if w.window_id == window_id), None)
            if win is None:
                return f"Error: no window with ID {window_id!r}"
        else:
            win = app.current_terminal_window
            if win is None:
                return "Error: no active iTerm2 window."
        tab = await win.async_create_tab(profile=profile, command=command)
        if tab is None:
            return "Error: failed to create tab."
        sess = tab.current_session
        return f"Created tab {tab.tab_id}, session {sess.session_id if sess else '?'}"
  • The tool is registered via the @mcp.tool() decorator on the FastMCP instance named 'mcp' (instantiated on line 21).
    @mcp.tool()
  • Input schema/parameters for create_tab: window_id (optional str), command (optional str), profile (optional str). Returns a string.
        window_id: str | None = None,
        command: str | None = None,
        profile: str | None = None,
    ) -> str:
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, so the description carries the full burden. It only lists parameter docstrings and does not disclose behavioral traits such as whether the tab becomes active, side effects, or authentication/rate limits. The description adds minimal behavioral context beyond the input schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise: one sentence stating the action plus three parameter lines. No redundant or irrelevant information. Front-loaded with the core purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values are documented elsewhere. However, the description lacks context about the effects of creating a tab (e.g., whether it gets focus, relationship to sessions) and does not mention any requirements or side effects. It is adequate for a basic understanding but incomplete for full autonomous use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage; the description compensates by providing brief explanations for all three parameters (window_id defaults to current, command is a shell command, profile is an iTerm2 profile). This adds meaning beyond the schema, though descriptions are concise and could be more detailed.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create a new tab in a window') and the resource ('tab'). It is a specific verb+resource combination, but does not differentiate from sibling tools like 'create_window' or 'split_pane', which operate on different resources.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives (e.g., creating a new window or splitting a pane). There is no mention of prerequisites or contexts where this tool is appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lorencarvalho/iterm2-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server