app_open
Opens a Goose web application in your default browser, automatically serving it first if needed. Use this tool to launch and access your created apps directly.
Instructions
Open an app in the default web browser. If the app is not currently being served,
it will be served first.
Can only open one app at a time.
Args:
app_name: Name of the application to open
Returns:
A dictionary containing the result of the operation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app_name | Yes |
Implementation Reference
- main.py:515-581 (handler)The core handler function implementing the app_open tool. It serves the app if not running, then opens it in the default browser (preferring Chrome app mode on macOS).def app_open(app_name: str) -> Dict[str, Any]: """ Open an app in the default web browser. If the app is not currently being served, it will be served first. Can only open one app at a time. Args: app_name: Name of the application to open Returns: A dictionary containing the result of the operation """ global http_server try: # Find the app directory app_path = os.path.join(APP_DIR, app_name) if not os.path.exists(app_path): return { "success": False, "error": f"App '{app_name}' not found at {app_path}" } # If the server is not running, start it if not http_server: serve_result = app_serve(app_name) if not serve_result["success"]: return serve_result # Get the URL from the serve result url = serve_result["url"] else: # Use the current server port url = f"http://localhost:{server_port}" # Check if we're on macOS if os.uname().sysname == "Darwin": # macOS # Use Chrome in app mode chrome_path = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" if os.path.exists(chrome_path): logger.info(f"Opening app in Chrome app mode: {url}") # Use Popen instead of run to avoid blocking subprocess.Popen([chrome_path, f"--app={url}"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) else: # Fallback to default browser if Chrome is not installed logger.info(f"Chrome not found, opening in default browser: {url}") # Use Popen instead of run to avoid blocking subprocess.Popen(["open", url], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) else: # For non-macOS systems, use the default browser # Use Popen instead of run to avoid blocking subprocess.Popen(["open", url], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) return { "success": True, "app_name": app_name, "url": url, "message": f"App '{app_name}' opened in browser at {url}" } except Exception as e: logger.error(f"Error opening app: {e}") return {"success": False, "error": f"Failed to open app: {str(e)}"}
- main.py:514-514 (registration)MCP decorator that registers the app_open function as a tool.@mcp.tool()
- main.py:515-526 (schema)Function signature and docstring defining the input schema (app_name: str) and output (Dict[str, Any]).def app_open(app_name: str) -> Dict[str, Any]: """ Open an app in the default web browser. If the app is not currently being served, it will be served first. Can only open one app at a time. Args: app_name: Name of the application to open Returns: A dictionary containing the result of the operation """
- main.py:102-102 (helper)Documentation reference to the app_open tool in the system instructions.app_open - open an app in a browser (macos)