Skip to main content
Glama
qwert666

Foundry MCP Server

by qwert666

query_dataset

Execute SQL queries on Foundry datasets to extract, analyze, or transform data using Spark SQL syntax.

Instructions

Query a dataset using Spark SQL dialect e.g. "SELECT COUNT(*) FROM dataset_rid"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes

Implementation Reference

  • The main handler function for the 'query_dataset' MCP tool. It is registered via the @mcp.tool() decorator. Takes a SQL query string, executes it via FoundryClient SQL queries (preview mode), polls until succeeded, fetches results as Arrow stream, converts to Pandas DataFrame, and returns as JSON.
    @mcp.tool()
    def query_dataset(ctx: Context, query: str) -> dict:
        """ Query a dataset using Spark SQL dialect e.g. "SELECT COUNT(*) FROM `dataset_rid`" """
        foundry_client: FoundryClient = ctx.request_context.lifespan_context.foundry_client
        query_id = foundry_client.sql_queries.Query.execute(
            query=query,
            preview=True
        ).query_id
    
        succeeded = False
    
        while not succeeded:
            status = foundry_client.sql_queries.Query.get_status(query_id, preview=True)
            succeeded = status.type == "succeeded"
            if status.type == "failed" or status.type == "cancelled":
                raise Exception("Query failed or cancelled")
            sleep(2)
    
        results = foundry_client.sql_queries.Query.get_results(query_id, preview=True)
    
        return pa.ipc.open_stream(results).read_all().to_pandas().to_json()
Behavior2/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 mentions the Spark SQL dialect and provides a query example, but doesn't address critical behavioral aspects like whether this is a read-only operation, what permissions are required, potential rate limits, query execution time, error handling, or what happens with large result sets. The description adds minimal behavioral context beyond the basic action.

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 extremely concise - a single sentence that efficiently communicates the core functionality with an example. Every word earns its place, and the structure is front-loaded with the essential information. There's no wasted verbiage or unnecessary elaboration.

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 that this is a query tool with no annotations, no output schema, and minimal parameter documentation, the description is incomplete. It doesn't address what the tool returns, how results are formatted, error conditions, performance characteristics, or integration with sibling tools. For a tool that executes potentially complex queries, more contextual information would be expected.

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 some semantic context by specifying that queries use 'Spark SQL dialect' and providing an example query format. However, with 0% schema description coverage for the single 'query' parameter, the description doesn't fully compensate by explaining parameter constraints, valid query patterns, or syntax requirements beyond the basic example. The baseline is 3 since there's only one parameter, but more detail would be helpful.

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 action ('Query a dataset') and specifies the method ('using Spark SQL dialect'), which provides a specific verb+resource combination. However, it doesn't explicitly differentiate this tool from its sibling tools like 'query_ontology_type' or 'execute_function', which might have overlapping query capabilities.

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 when this tool is appropriate compared to sibling tools like 'query_ontology_type' or 'execute_function', nor does it provide any context about prerequisites, limitations, or typical use cases.

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/qwert666/mcp-server-foundry'

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