check_analysis_status
Check the status of a scientific peer review analysis and retrieve its final report using a unique run ID.
Instructions
Checks the status or retrieves the final report of a ReviewMetric analysis.
Args: run_id: The unique UUID of the analysis run.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| run_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/reviewmetric_mcp/server.py:51-52 (registration)The tool is registered as an MCP tool via the @mcp.tool() decorator on line 51.
@mcp.tool() def check_analysis_status(run_id: str) -> str: - src/reviewmetric_mcp/server.py:53-58 (schema)The input schema: takes a single 'run_id' string parameter. The docstring describes the tool's purpose.
""" Checks the status or retrieves the final report of a ReviewMetric analysis. Args: run_id: The unique UUID of the analysis run. """ - src/reviewmetric_mcp/server.py:59-91 (handler)The handler logic: makes a GET request to {API_BASE}/status/{run_id}, interprets the response status (queued/running/completed/failed), and returns appropriate messages.
try: response = requests.get(f"{API_BASE}/status/{run_id}", headers=get_headers()) if response.status_code == 200: data = response.json() status = data.get("status") if status == 'queued': pos = data.get('queue_position', 0) + 1 eta = data.get('eta_minutes', '?') return f"Status: QUEUED. Position in line: {pos}. Estimated time: {eta} minutes. Claude, wait a bit and check again." elif status == 'running': step = data.get("current_step", "Processing...") return f"Status: RUNNING. Current Step: {step}. Claude, wait 45 seconds and check again. If you hit your tool loop limit, gracefully tell the user the current step and ask them to prompt you to check again." elif status == 'completed': # Return the beautiful JSON report directly to Claude's brain! report = data.get("summary_report", {}) return f"Status: COMPLETED. Here is the final ReviewMetric JSON report. Claude, please summarize this for the user:\n\n{json.dumps(report, indent=2)}" elif status == 'failed': error = data.get("error_message", "Unknown error") return f"Status: FAILED. The pipeline crashed with error: {error}" else: return f"Status: {status.upper()}" else: return f"API Error ({response.status_code}): {response.text}" except Exception as e: return f"Failed to connect to ReviewMetric server: {str(e)}" - src/reviewmetric_mcp/server.py:16-19 (helper)Helper function get_headers() used by the handler to set the Authorization header with the API key.
def get_headers(): if not API_KEY: raise ValueError("REVIEWMETRIC_API_KEY environment variable is missing.") return {"Authorization": f"Bearer {API_KEY}"}