get_job_results_summary
Retrieve a preview of Dune Analytics query results with statistics to quickly assess data insights before full analysis.
Instructions
Get result preview (5 rows) and stats.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| job_id | Yes |
Implementation Reference
- src/main.py:239-263 (handler)The handler function for the 'get_job_results_summary' tool, decorated with @mcp.tool() for registration. It checks job status, fetches results, processes a preview (5 rows), and returns summary stats.@mcp.tool() def get_job_results_summary(job_id: str) -> str: """ Get result preview (5 rows) and stats. """ try: # Check status first status_data = dune_service.get_status(job_id) state = status_data.get("state", "UNKNOWN") if state != "QUERY_STATE_COMPLETED" and state != "COMPLETED": return f"Job is not complete (Status: {state}). Please wait." raw_result = dune_service.get_result(job_id) processed = data_processor.process_results(raw_result, limit=5) return ( f"Row Count: {processed['row_count']}\n" f"Columns: {processed['columns']}\n" f"Preview (First 5 rows): {processed['preview']}\n" f"Stats: {processed.get('summary_stats', 'N/A')}\n" f"Tip: To see all data, use 'export_results_to_csv'." ) except Exception as e: return f"Error fetching results: {str(e)}"