app_response
Return structured responses to web applications created with Goose App Maker MCP, providing string, list, or table data formats for app functionality.
Instructions
Use this to return a response to the app that has been requested.
Provide only one of string_data, list_data, or table_data.
Args:
string_data: Optional string response
list_data: Optional list of strings response
table_data: Optional table response with columns and rows
Format: {"columns": ["col1", "col2", ...], "rows": [["row1col1", "row1col2", ...], ...]}
Returns:
True if the response was stored successfully, False otherwise
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| string_data | No | ||
| list_data | No | ||
| table_data | No |
Implementation Reference
- main.py:616-665 (handler)The core handler function for the 'app_response' MCP tool. It validates input (ensuring exactly one of string_data, list_data, or table_data is provided), stores the data in a global app_response variable, sets response_ready flag, and notifies waiting threads for the web app's HTTP polling endpoint to retrieve it.def app_response(string_data: str = None, list_data: List[str] = None, table_data: Dict[str, List] = None) -> bool: """ Use this to return a response to the app that has been requested. Provide only one of string_data, list_data, or table_data. Args: string_data: Optional string response list_data: Optional list of strings response table_data: Optional table response with columns and rows Format: {"columns": ["col1", "col2", ...], "rows": [["row1col1", "row1col2", ...], ...]} Returns: True if the response was stored successfully, False otherwise """ global app_response, response_lock, response_ready try: # Check that exactly one data type is provided provided_data = [d for d in [string_data, list_data, table_data] if d is not None] if len(provided_data) != 1: logger.error("Exactly one of string_data, list_data, or table_data must be provided") return False # Determine the type of data and store it if string_data is not None: data = string_data elif list_data is not None: data = list_data elif table_data is not None: # Validate table_data format if not isinstance(table_data, dict) or "columns" not in table_data or "rows" not in table_data: logger.error("Table data must have 'columns' and 'rows' keys") return False data = table_data # Store the response and notify waiting threads with response_lock: global app_response # Declare global inside the function block app_response = data global response_ready # Declare global inside the function block response_ready = True response_lock.notify_all() return True except Exception as e: logger.error(f"Error storing response: {e}") return False
- main.py:616-616 (registration)The @mcp.tool() decorator registers the app_response function as an MCP tool.def app_response(string_data: str = None,
- main.py:617-631 (schema)The function signature and docstring define the input schema (string_data, list_data, table_data) and output (bool success), with validation logic inside.list_data: List[str] = None, table_data: Dict[str, List] = None) -> bool: """ Use this to return a response to the app that has been requested. Provide only one of string_data, list_data, or table_data. Args: string_data: Optional string response list_data: Optional list of strings response table_data: Optional table response with columns and rows Format: {"columns": ["col1", "col2", ...], "rows": [["row1col1", "row1col2", ...], ...]} Returns: True if the response was stored successfully, False otherwise """
- main.py:38-40 (helper)Global variables used by the app_response tool handler and the HTTP server's wait_for_response endpoint to communicate responses from the MCP server to the web app frontend.app_response = None response_lock = threading.Condition() response_ready = False