list-terminals
Retrieve details of all active terminal sessions managed by the iTerm MCP Server to monitor or interact with open terminals in iTerm2.
Instructions
List all active terminals and their information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:243-262 (registration)Registration of the 'list-terminals' tool, including empty input schema and inline handler function that lists active terminal IDs and count using the global 'terminals' Map.server.tool( "list-terminals", "List all active terminals and their information", {}, async () => { const activeTerminals = Array.from(terminals.entries()).map(([id]) => id); const count = terminals.size; return { content: [ { type: "text", text: `Number of active terminals: ${count}\nActive terminal IDs: ${ activeTerminals.join(", ") || "None" }`, }, ], }; } );
- index.js:247-261 (handler)The handler function for 'list-terminals' tool. It extracts terminal IDs from the global 'terminals' Map, counts them, and returns a formatted text response listing the count and IDs.async () => { const activeTerminals = Array.from(terminals.entries()).map(([id]) => id); const count = terminals.size; return { content: [ { type: "text", text: `Number of active terminals: ${count}\nActive terminal IDs: ${ activeTerminals.join(", ") || "None" }`, }, ], }; }
- index.js:246-246 (schema)Empty input schema (no parameters) for the 'list-terminals' tool.{},