download_batch_results
Retrieve processed OCR results from completed batch jobs to access extracted text and structured data in markdown or HTML formats.
Instructions
Download results from a completed batch job.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| arguments | Yes |
Implementation Reference
- src/mcp_mistral_ocr_opt/main.py:544-575 (handler)The handler implementation for the 'download_batch_results' tool, which takes a 'job_id', downloads the results using the batch processor, and returns the path to the results file.
@app.tool("download_batch_results") async def download_batch_results(arguments: Dict[str, Any]) -> List[TextContent]: """Download results from a completed batch job.""" job_id = arguments.get("job_id") if not job_id: raise McpError(ErrorData(code=INVALID_PARAMS, message="job_id is required")) try: batch_proc = await get_batch_processor() results_path = await batch_proc.download_job_results(job_id, config.output_dir) return [ TextContent( type="text", text=json.dumps( { "message": "Batch results downloaded successfully", "results_file": results_path, "job_id": job_id, }, indent=2, ensure_ascii=False, ), ) ] except Exception as e: raise McpError( ErrorData( code=INTERNAL_ERROR, message=f"Error downloading batch results: {str(e)}", ) )