user_feedback
Collect user feedback on project changes by submitting a directory path and summary for review.
Instructions
Request user feedback for a given project directory and summary
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_directory | Yes | Full path to the project directory | |
| summary | Yes | Short, one-line summary of the changes |
Implementation Reference
- server.py:62-68 (handler)The main handler function for the 'user_feedback' tool. It processes inputs, extracts first lines, launches the feedback UI subprocess, and returns the result as a dictionary.def user_feedback( project_directory: Annotated[str, Field(description="Full path to the project directory")], summary: Annotated[str, Field(description="Short, one-line summary of the changes")], ) -> Dict[str, str]: """Request user feedback for a given project directory and summary""" return launch_feedback_ui(first_line(project_directory), first_line(summary))
- server.py:63-65 (schema)Input schema defined using Pydantic's Annotated and Field for descriptions, with output as Dict[str, str].project_directory: Annotated[str, Field(description="Full path to the project directory")], summary: Annotated[str, Field(description="Short, one-line summary of the changes")], ) -> Dict[str, str]:
- server.py:61-61 (registration)Registers the user_feedback function as an MCP tool using the FastMCP decorator.@mcp.tool()
- server.py:15-56 (helper)Helper function that launches the feedback_ui.py as a subprocess to collect user feedback and returns the result.def launch_feedback_ui(project_directory: str, summary: str) -> dict[str, str]: # Create a temporary file for the feedback result with tempfile.NamedTemporaryFile(suffix=".json", delete=False) as tmp: output_file = tmp.name try: # Get the path to feedback_ui.py relative to this script script_dir = os.path.dirname(os.path.abspath(__file__)) feedback_ui_path = os.path.join(script_dir, "feedback_ui.py") # Run feedback_ui.py as a separate process # NOTE: There appears to be a bug in uv, so we need # to pass a bunch of special flags to make this work args = [ sys.executable, "-u", feedback_ui_path, "--project-directory", project_directory, "--prompt", summary, "--output-file", output_file ] result = subprocess.run( args, check=False, shell=False, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, stdin=subprocess.DEVNULL, close_fds=True ) if result.returncode != 0: raise Exception(f"Failed to launch feedback UI: {result.returncode}") # Read the result from the temporary file with open(output_file, 'r') as f: result = json.load(f) os.unlink(output_file) return result except Exception as e: if os.path.exists(output_file): os.unlink(output_file) raise e
- server.py:58-60 (helper)Utility function to extract the first line from a string, used to shorten inputs for the UI.def first_line(text: str) -> str: return text.split("\n")[0].strip()