Skip to main content
Glama
TrueOleg

MCP Mac Apps Server

by TrueOleg

run_applescript

Execute AppleScript commands in macOS applications to automate tasks and control app behavior programmatically.

Instructions

Выполняет AppleScript команду в указанном приложении. Полезно для автоматизации действий в приложениях

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appNameYesИмя приложения (например, 'Safari', 'Finder')
scriptYesAppleScript команда для выполнения

Implementation Reference

  • TypeScript handler that constructs and executes AppleScript targeting the specified application using osascript command.
    private async runAppleScript(appName: string, script: string) {
      try {
        // Выполняем AppleScript в контексте указанного приложения
        const appleScript = `
          tell application "${appName}"
            ${script}
          end tell
        `;
    
        const { stdout, stderr } = await execAsync(
          `osascript -e '${appleScript.replace(/'/g, "'\\''")}'`
        );
    
        return {
          content: [
            {
              type: "text",
              text: stdout || stderr || "Команда выполнена успешно",
            },
          ],
        };
      } catch (error) {
        throw new Error(
          `Ошибка выполнения AppleScript: ${error instanceof Error ? error.message : String(error)}`
        );
      }
    }
  • Python handler that constructs and executes AppleScript targeting the specified application using osascript command.
    def run_applescript(app_name: str, script: str) -> str:
        """Executes AppleScript command"""
        apple_script = f'tell application "{app_name}"\n{script}\nend tell'
        # Escape single quotes
        apple_script_escaped = apple_script.replace("'", "'\\''")
        stdout, stderr = exec_command(f"osascript -e '{apple_script_escaped}'")
        return stdout or stderr or "Command executed successfully"
  • TypeScript input schema definition for the run_applescript tool.
    name: "run_applescript",
    description:
      "Выполняет AppleScript команду в указанном приложении. Полезно для автоматизации действий в приложениях",
    inputSchema: {
      type: "object",
      properties: {
        appName: {
          type: "string",
          description: "Имя приложения (например, 'Safari', 'Finder')",
        },
        script: {
          type: "string",
          description: "AppleScript команда для выполнения",
        },
      },
      required: ["appName", "script"],
    },
  • Python input schema definition for the run_applescript tool.
    "name": "run_applescript",
    "description": "Executes AppleScript command in specified application. Useful for automating actions in applications",
    "inputSchema": {
        "type": "object",
        "properties": {
            "appName": {
                "type": "string",
                "description": "Application name (e.g., 'Safari', 'Finder')",
            },
            "script": {
                "type": "string",
                "description": "AppleScript command to execute",
            },
        },
        "required": ["appName", "script"],
    },
  • src/index.ts:314-318 (registration)
    TypeScript switch case dispatching to the runAppleScript handler.
    case "run_applescript":
      return await this.runAppleScript(
        args?.appName as string,
        args?.script as string
      );
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. While it mentions the tool executes AppleScript commands, it doesn't describe important behavioral aspects: whether this requires specific permissions, what happens if the application isn't running, whether scripts can be destructive, error handling, or what the response looks like. For a tool that executes arbitrary scripts with no annotation coverage, this is a significant gap.

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

Conciseness4/5

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

The description is appropriately concise with two sentences that each serve a purpose: the first states what the tool does, the second provides context about its utility. There's no wasted text, and the information is front-loaded with the core functionality stated first.

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

Completeness2/5

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

Given this is a tool that executes arbitrary AppleScript commands with no annotations and no output schema, the description is insufficiently complete. It doesn't address security implications, permission requirements, error conditions, or what kind of response to expect. For a potentially powerful automation tool with zero structured safety information, the description should do more to guide safe and effective use.

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

Parameters3/5

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

The description doesn't add any parameter semantics beyond what's already in the schema, which has 100% coverage with clear descriptions for both parameters. The baseline is 3 when schema coverage is high (>80%), even with no additional param information in the description. The description doesn't explain parameter relationships or provide usage examples.

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 tool's purpose: 'Выполняет AppleScript команду в указанном приложении' (Executes an AppleScript command in the specified application). It specifies both the verb ('выполняет' - executes) and the resource (AppleScript command in an application). However, it doesn't explicitly differentiate from sibling tools like 'open_application' or 'quit_application' which are also application-related but perform different actions.

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?

The description provides some implied usage context with 'Полезно для автоматизации действий в приложениях' (Useful for automating actions in applications), suggesting this is for automation tasks. However, it doesn't explicitly state when to use this versus alternatives like 'open_application' or 'quit_application', nor does it provide any exclusion criteria or prerequisites for use.

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/TrueOleg/MCP-expirements'

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