status
Review which applications are permitted and if dangerous command blocking is active to ensure safe AppleScript operations.
Instructions
Returns the list of allowed apps and whether dangerous command blocking is enabled.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp_applescript/__init__.py:13-28 (handler)The 'status' tool handler function. Decorated with @mcp.tool(), it returns a dict with 'allowed_apps' (display-friendly list of allowed apps) and 'block_dangerous' (boolean indicating if dangerous pattern blocking is enabled). It delegates to helper functions get_allowed_apps() and is_dangerous_blocking_enabled().
@mcp.tool() async def status() -> dict: """Returns the list of allowed apps and whether dangerous command blocking is enabled.""" allowed_apps = get_allowed_apps() if "*" in allowed_apps: apps_display = "all applications" elif not allowed_apps: apps_display = "none (all blocked)" else: apps_display = allowed_apps return { "allowed_apps": apps_display, "block_dangerous": is_dangerous_blocking_enabled(), } - src/mcp_applescript/__init__.py:13-14 (registration)The 'status' tool is registered via the @mcp.tool() decorator on line 13, which registers the async function as an MCP tool on the FastMCP instance named 'mcp'.
@mcp.tool() async def status() -> dict: - src/mcp_applescript/utils.py:7-23 (helper)Helper function get_allowed_apps() reads the ALLOWED_APPS environment variable, returning a list of allowed app names (or ['*'] for all, or [] for none).
def get_allowed_apps() -> list[str]: """ Get the list of allowed applications from environment variable. """ # Default to "*" if not set allowed = os.getenv("ALLOWED_APPS", "*").strip() # Empty string means explicit lockdown if not allowed: return [] # Wildcard means allow all if allowed == "*": return ["*"] # Parse comma-separated list, normalize to title case for AppleScript return [app.strip().title() for app in allowed.split(",") if app.strip()] - src/mcp_applescript/utils.py:26-31 (helper)Helper function is_dangerous_blocking_enabled() reads the BLOCK_DANGEROUS environment variable (defaulting to 'true') and returns a boolean.
def is_dangerous_blocking_enabled() -> bool: """ Check if dangerous pattern blocking is enabled. """ value = os.getenv("BLOCK_DANGEROUS", "true").lower() return value in ("true", "1", "yes", "on")