submit_manuscript
Submits a locally saved .docx manuscript to the ReviewMetric 15-agent AI pipeline for automated peer review.
Instructions
Submits a locally saved .docx manuscript to the ReviewMetric 15-agent AI pipeline.
Args: file_path: The absolute path on the local computer to the .docx file.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/reviewmetric_mcp/server.py:22-49 (handler)The submit_manuscript function is the handler for the tool. It accepts a file_path argument, checks the file exists and is .docx, then POSTs it to the ReviewMetric /analyze endpoint, returning a run_id on success.
def submit_manuscript(file_path: str) -> str: """ Submits a locally saved .docx manuscript to the ReviewMetric 15-agent AI pipeline. Args: file_path: The absolute path on the local computer to the .docx file. """ if not os.path.exists(file_path): return f"Error: File not found at {file_path}. Please check the path." if not file_path.endswith('.docx'): return "Error: ReviewMetric currently only supports .docx files." try: with open(file_path, 'rb') as f: files = {'file': (os.path.basename(file_path), f, 'application/vnd.openxmlformats-officedocument.wordprocessingml.document')} response = requests.post(f"{API_BASE}/analyze", headers=get_headers(), files=files) if response.status_code in [200, 202]: data = response.json() run_id = data.get('run_id') return f"Success! Manuscript submitted to ReviewMetric. The Run ID is: {run_id}. \n\nClaude, please use the `check_analysis_status` tool with this Run ID to poll for the results every 15 seconds." elif response.status_code == 402: return "Error: Insufficient ReviewMetric credits. Please top up your account." 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:21-22 (registration)The @mcp.tool() decorator on line 21 registers submit_manuscript as an MCP tool on the FastMCP server instance.
@mcp.tool() def submit_manuscript(file_path: str) -> str: - src/reviewmetric_mcp/server.py:23-28 (schema)The docstring defines the schema: accepts a single required parameter 'file_path' (str) representing the absolute path to a .docx file.
""" Submits a locally saved .docx manuscript to the ReviewMetric 15-agent AI pipeline. Args: file_path: The absolute path on the local computer to the .docx file. """ - src/reviewmetric_mcp/server.py:16-19 (helper)The get_headers() helper function returns the Authorization header using the API_KEY environment variable, used by submit_manuscript.
def get_headers(): if not API_KEY: raise ValueError("REVIEWMETRIC_API_KEY environment variable is missing.") return {"Authorization": f"Bearer {API_KEY}"}