Skip to main content
Glama

create_window

Launch a new iTerm2 window. Optionally run a shell command or select a profile.

Instructions

Create a new iTerm2 window.

:param command: Optional shell command to run in the new session. :param profile: Name of the iTerm2 profile to use. Defaults to the default profile.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandNo
profileNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The create_window tool handler - creates a new iTerm2 window. Uses @mcp.tool() decorator (FastMCP) with optional 'command' and 'profile' parameters. Calls iterm2.Window.async_create() and returns the window ID and session ID on success.
    @mcp.tool()
    async def create_window(
        command: str | None = None,
        profile: str | None = None,
    ) -> str:
        """Create a new iTerm2 window.
    
        :param command: Optional shell command to run in the new session.
        :param profile: Name of the iTerm2 profile to use. Defaults to the default
            profile.
        """
        conn = await _connection_singleton()
        win = await iterm2.Window.async_create(conn, profile=profile, command=command)
        if win is None:
            return "Error: failed to create window."
        sess = win.current_tab.current_session if win.current_tab else None
        suffix = f", session {sess.session_id}" if sess else ""
        return f"Created window {win.window_id}{suffix}"
  • The FastMCP server instance 'mcp' is created here. The @mcp.tool() decorator on line 276 registers the create_window tool.
    mcp = FastMCP("iterm2-mcp")
Behavior3/5

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

No annotations provided, so the description carries the burden. It discloses that a new window is created and parameter defaults, but lacks details on side effects (e.g., focus behavior, error conditions, or session identification).

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 brief with two sentences: one for purpose and one structured parameter documentation. No wasted words.

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

Completeness4/5

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

Given an output schema exists, return values need not be explained. The description covers the tool's purpose and both parameters adequately. Minor omission: no mention of prerequisites like iTerm2 running.

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?

Schema coverage is 0% with only titles and types. The description adds meaningful details: 'command' is an optional shell command, 'profile' is a profile name defaulting to default. This compensates for the schema gap.

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

Purpose5/5

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

The description clearly states 'Create a new iTerm2 window' with a specific verb and resource. It distinguishes from sibling tools like create_tab (creates tab in existing window) and split_pane (splits pane).

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

Usage Guidelines3/5

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

Implied usage is clear (when a new window is needed), but no explicit guidance on when to use this vs alternatives like create_tab or split_pane, nor when not to use it.

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