Skip to main content
Glama

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
NameRequiredDescriptionDefault
job_idYes

Implementation Reference

  • The handler function for the get_job_results_summary tool. It is registered via the @mcp.tool() decorator. Fetches job status, retrieves results if complete, processes a preview of the first 5 rows using data_processor.process_results, and returns a formatted summary including row count, columns, preview, and stats.
    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)}"

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nice-bills/dune-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server