Skip to main content
Glama
samhavens

Databricks MCP Server

by samhavens

get_sql_status

Check the execution status and retrieve results for SQL queries in Databricks using statement IDs.

Instructions

Get the status and results of a SQL statement by statement_id

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
statement_idYes

Implementation Reference

  • MCP tool handler and registration for 'get_sql_status'. Takes statement_id as input, fetches status via sql.get_statement_status helper, returns JSON result or error.
    @mcp.tool()
    async def get_sql_status(statement_id: str) -> str:
        """Get the status and results of a SQL statement by statement_id"""
        logger.info(f"Getting status for SQL statement: {statement_id}")
        try:
            result = await sql.get_statement_status(statement_id)
            return json.dumps(result)
        except Exception as e:
            logger.error(f"Error getting SQL status: {str(e)}")
            return json.dumps({"error": str(e)})
  • Supporting utility function that performs the actual API call to Databricks /sql/statements/{statement_id} endpoint to retrieve the SQL statement status.
    async def get_statement_status(statement_id: str) -> Dict[str, Any]:
        """
        Get the status of a SQL statement.
        
        Args:
            statement_id: ID of the statement to check
            
        Returns:
            Response containing statement status
            
        Raises:
            DatabricksAPIError: If the API request fails
        """
        logger.info(f"Getting status of SQL statement: {statement_id}")
        return make_api_request("GET", f"/api/2.0/sql/statements/{statement_id}", params={})
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states it 'gets' status and results, implying a read-only operation, but doesn't disclose behavioral traits like authentication needs, rate limits, error handling, or what 'status' and 'results' entail (e.g., success/failure, data format). For a tool with no annotations, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose ('Get the status and results') and specifies the key parameter ('by statement_id'). There is zero waste, and every word earns its place, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and low schema coverage, the description is incomplete. It doesn't explain what 'status' and 'results' mean, how they're returned, or any dependencies (e.g., statement_id from execute_sql_nonblocking). For a tool that retrieves SQL execution outcomes, more context is needed to understand its full usage and behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaning by specifying that statement_id is used to identify the SQL statement, which the input schema only titles as 'Statement Id' with 0% coverage. However, with only 1 parameter and low schema coverage, it partially compensates but doesn't explain what a statement_id is (e.g., from execute_sql_nonblocking) or its format. Baseline is 3 as it adds some semantics beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('status and results of a SQL statement'), specifying it's done 'by statement_id'. It distinguishes from siblings like execute_sql (which runs SQL) and list_jobs (which lists jobs), but doesn't explicitly contrast with similar tools like get_cluster or get_job. The purpose is specific but could be more differentiated from other 'get' tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a statement_id from execute_sql_nonblocking), when-not-to-use scenarios, or comparisons to siblings like list_job_runs for job status. Usage is implied only by the tool name and description, lacking explicit context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/samhavens/databricks-mcp-server'

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