Skip to main content
Glama

iterm_run

Execute terminal commands in iTerm directly from LLM applications, with options to run in new windows or existing sessions.

Instructions

[iTerm terminal operations] Run a command in iTerm

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYesCommand to run in iTerm
newWindowNoWhether to open in a new window (default: false)

Implementation Reference

  • Core handler logic for 'iterm_run' tool: generates AppleScript to run the specified command in an iTerm window, optionally in a new window.
    script: (args) => `
      tell application "iTerm"
        ${
          args.newWindow
            ? `
          set newWindow to (create window with default profile)
          tell current session of newWindow
        `
            : `
          set w to current window
          tell w's current session
        `
        }
          write text "${args.command}"
          activate
        end tell
      end tell
    `,
  • Input schema definition for the 'iterm_run' tool, specifying 'command' as required and optional 'newWindow' parameter.
    schema: {
      type: "object",
      properties: {
        command: {
          type: "string",
          description: "Command to run in iTerm",
        },
        newWindow: {
          type: "boolean",
          description: "Whether to open in a new window (default: false)",
          default: false,
        },
      },
      required: ["command"],
    },
  • Registers tool names using '{category}_{script}' format, creating 'iterm_run' from 'iterm' category and 'run' script.
    name: `${category.name}_${script.name}`, // Changed from dot to underscore
  • src/index.ts:30-30 (registration)
    Registers the 'iterm' ScriptCategory containing the 'run' script (becomes 'iterm_run' tool).
    server.addCategory(itermCategory);

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/joshrutkowski/applescript-mcp'

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