Skip to main content
Glama

get_job_status

Check the execution status of a Dune Analytics query by providing a job ID. Monitors progress for up to 30 seconds to determine completion.

Instructions

Check query execution status. Polls for 30s.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
job_idYes

Implementation Reference

  • The main handler function for the 'get_job_status' tool, decorated with @mcp.tool() for registration. It polls the Dune service for job status up to 30 seconds and returns the status or error.
    def get_job_status(job_id: str) -> str:
        """
        Check query execution status. Polls for 30s.
        """
        try:
            # Internal polling loop (max 30s)
            import time
            max_retries = 15 # 15 * 2s = 30s
            for i in range(max_retries):
                status_data = dune_service.get_status(job_id)
                state = status_data.get("state", "UNKNOWN")
                
                if state in ["COMPLETED", "FAILED", "CANCELLED"]:
                    msg = f"Job {job_id} is {state}"
                    credits = status_data.get("credits_used")
                    if credits is not None:
                        msg += f" (Cost: {credits} Credits)"
                    return msg
                
                # If running, wait a bit
                time.sleep(2)
                
            # If still running after 30s
            return f"Job {job_id} is still {state}. Please check again later."
            
        except Exception as e:
            return f"Error checking status: {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