Skip to main content
Glama
ChrisChoTW

databricks-mcp

by ChrisChoTW

databricks_query

Execute read-only SQL queries on Databricks to retrieve data, browse metadata, and monitor Delta Lake tables without performing destructive operations.

Instructions

Execute Databricks SQL query (supports SELECT, SHOW, DESCRIBE, CREATE, ALTER). INSERT, UPDATE, DELETE, DROP and other destructive operations are blocked.

Args: sql_query: SQL query statement (preferred parameter) sql: SQL query statement (fallback for backward compatibility)

Returns: Query results as list of dicts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sql_queryNo
sqlNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The databricks_query function is defined and decorated as an MCP tool, containing logic to validate against destructive SQL operations before calling execute_sql.
    @mcp.tool
    def databricks_query(ctx: Context, sql_query: Optional[str] = None, sql: Optional[str] = None) -> List[Dict[str, Any]]:
        """
        Execute Databricks SQL query (supports SELECT, SHOW, DESCRIBE, CREATE, ALTER).
        INSERT, UPDATE, DELETE, DROP and other destructive operations are blocked.
    
        Args:
            sql_query: SQL query statement (preferred parameter)
            sql: SQL query statement (fallback for backward compatibility)
    
        Returns:
            Query results as list of dicts
        """
        query_to_execute = sql_query if sql_query is not None else sql
    
        if query_to_execute is None:
            raise ToolError("Must provide sql_query or sql parameter.")
    
        query_upper = query_to_execute.strip().upper()
        forbidden_keywords = [
            "INSERT INTO", "UPDATE ", "DELETE FROM", "DROP TABLE", "DROP VIEW",
            "DROP SCHEMA", "DROP CATALOG", "TRUNCATE TABLE", "MERGE INTO", "COPY INTO"
        ]
        for keyword in forbidden_keywords:
            if keyword in query_upper:
                raise ToolError(f"Destructive operation not allowed: {keyword}")
        return execute_sql(ctx, query_to_execute)
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively communicates key behavioral traits: the tool executes SQL queries, supports specific operation types, blocks destructive operations, and returns query results as list of dicts. It doesn't mention authentication requirements, rate limits, or error handling, but provides solid core behavioral information.

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 efficiently structured with a clear purpose statement upfront, followed by specific operational boundaries, then parameter explanations, and finally return format. Every sentence earns its place with no redundant information, making it easy to parse and understand quickly.

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

Completeness4/5

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

Given the tool's complexity (SQL execution with operation restrictions), no annotations, and the presence of an output schema (which handles return value documentation), the description provides strong contextual completeness. It covers purpose, usage boundaries, parameter roles, and behavioral constraints. The main gap is lack of authentication/error handling details, but overall it's quite complete.

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

Parameters4/5

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

With 0% schema description coverage for the 2 parameters, the description compensates well by explaining that 'sql_query' is the preferred parameter for SQL query statements while 'sql' serves as a fallback for backward compatibility. This adds meaningful context beyond the bare schema, though it doesn't provide format examples or validation rules.

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

Purpose5/5

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

The description clearly states the specific action ('Execute Databricks SQL query') and resource ('Databricks'), and explicitly distinguishes this tool from its siblings by listing supported operations (SELECT, SHOW, DESCRIBE, CREATE, ALTER) and blocked operations (INSERT, UPDATE, DELETE, DROP). This provides precise differentiation from read-only sibling tools like get_table_schema or list_tables.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool (for executing SQL queries with specific allowed operations) and when not to use it (for destructive operations like INSERT, UPDATE, DELETE, DROP which are blocked). This clearly establishes the tool's scope and limitations relative to alternatives.

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

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