app_error
Report app errors or retrieve error lists for debugging. Clear error logs or log new messages to monitor app issues during development on Goose App Maker MCP.
Instructions
Report an error from the app or retrieve the list of errors.
This is useful while developing or debugging the app as it allows errors (or any messages) to be reported and monitored
Args:
error_message: Optional error message to report. If None, returns the list of errors.
clear: Optional, If True, clears the list of errors
Returns:
A string containing the list of errors if error_message is None,
otherwise a confirmation message.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clear | No | ||
| error_message | No |
Implementation Reference
- main.py:666-715 (handler)The primary handler for the 'app_error' tool. This function either reports a new error message (appending it to the global app_errors list with timestamp) or retrieves and formats the list of existing errors. It is registered as an MCP tool via the @mcp.tool() decorator. The function signature defines the input schema: optional error_message (str) and clear (bool).@mcp.tool() def app_error(error_message: str = None, clear = False) -> str: """ Report an error from the app or retrieve the list of errors. This is useful while developing or debugging the app as it allows errors (or any messages) to be reported and monitored Args: error_message: Optional error message to report. If None, returns the list of errors. clear: Optional, If True, clears the list of errors Returns: A string containing the list of errors if error_message is None, otherwise a confirmation message. """ global app_errors try: # If no error message is provided, return the list of errors if error_message is None: # if app errors is empty if not app_errors: return "No errors reported. If needed, consider adding in some calls to reportError() in your app code to help with debugging." # Format the errors as a numbered list error_list = "\n".join([f"{i+1}. {err}" for i, err in enumerate(app_errors)]) if clear: app_errors.clear() return f"Reported errors:\n{error_list}" if clear: app_errors.clear() # Add the error to the list with a timestamp timestamp = time.strftime("%Y-%m-%d %H:%M:%S") app_errors.append(f"[{timestamp}] {error_message}") # Keep only the last 100 errors to prevent unbounded growth if len(app_errors) > 100: app_errors = app_errors[-100:] logger.warning(f"App error reported: {error_message}") return f"Error reported: {error_message}" except Exception as e: logger.error(f"Error handling app_error: {e}") return f"Failed to process error: {str(e)}"
- main.py:43-43 (helper)Global list that stores all reported application errors, used by the app_error tool to accumulate and retrieve errors.app_errors = []