list_profiles
Retrieve all iTerm2 profiles, including their names and GUIDs, to manage terminal configurations.
Instructions
List all iTerm2 profiles with their names and GUIDs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/iterm2_mcp/server.py:400-406 (handler)The handler function that executes the list_profiles tool logic. It queries all iTerm2 profiles via PartialProfile.async_query and returns their names and GUIDs as a newline-separated string.
@mcp.tool() async def list_profiles() -> str: """List all iTerm2 profiles with their names and GUIDs.""" conn = await _connection_singleton() profiles = await iterm2.PartialProfile.async_query(conn) lines = [f"{p.name} [{p.guid}]" for p in profiles] return "\n".join(lines) if lines else "(no profiles)" - src/iterm2_mcp/server.py:400-400 (registration)The tool is registered via the @mcp.tool() decorator on the list_profiles async function. This registers it with the FastMCP server instance.
@mcp.tool() - src/iterm2_mcp/server.py:27-33 (helper)The _connection_singleton helper that creates/reuses the shared iTerm2 connection, used internally by list_profiles.
async def _connection_singleton() -> iterm2.Connection: """Return the shared iTerm2 connection, creating it on first use.""" global _connection async with _conn_lock: if _connection is None: _connection = await iterm2.Connection.async_create() return _connection