Skip to main content
Glama
pab1it0

adx-mcp-server

sample_table_data

Retrieve a random sample of rows from Azure Data Explorer tables to preview data structure and content before analysis.

Instructions

Retrieves a random sample of rows from the specified table in the Azure Data Explorer database. The sample_size parameter controls how many rows to return (default: 10).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
table_nameYes
sample_sizeNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'sample_table_data' tool, which is automatically registered via the @mcp.tool decorator. It samples rows from a specified ADX table using a KQL query and formats the results into a list of dictionaries.
    @mcp.tool(description="Retrieves a random sample of rows from the specified table in the Azure Data Explorer database. The sample_size parameter controls how many rows to return (default: 10).")
    async def sample_table_data(table_name: str, sample_size: int = 10) -> List[Dict[str, Any]]:
        """Get sample data from a table."""
        logger.info("Sampling table data", table_name=table_name, sample_size=sample_size, database=config.database)
    
        if not config.cluster_url or not config.database:
            logger.error("Missing ADX configuration")
            raise ValueError("Azure Data Explorer configuration is missing. Please set ADX_CLUSTER_URL and ADX_DATABASE environment variables.")
    
        try:
            client = get_kusto_client()
            query = f"{table_name} | sample {sample_size}"
            result_set = client.execute(config.database, query)
            results = format_query_results(result_set)
            logger.info("Sample data retrieved successfully", table_name=table_name, row_count=len(results))
            return results
        except Exception as e:
            logger.error("Failed to sample table data", table_name=table_name, error=str(e), exception_type=type(e).__name__)
            raise
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses key behavioral traits: it's a read operation ('Retrieves'), returns random sampling (not deterministic), and has a default parameter. However, it doesn't mention potential limitations like rate limits, authentication needs, or whether the sampling is truly random versus pseudorandom. For a read tool with no annotations, this is adequate but lacks depth on operational constraints.

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 appropriately sized and front-loaded: the first sentence states the core purpose, and the second adds crucial parameter details. Every sentence earns its place by providing essential information without redundancy. It's efficient and well-structured for quick comprehension by an AI agent.

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 low complexity (2 parameters, no nested objects) and the presence of an output schema (which handles return values), the description is largely complete. It covers purpose, key parameters, and basic behavior. However, without annotations, it could benefit from more context on operational aspects like performance or sampling methodology. For a simple read tool with output schema support, this is good but not exhaustive.

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?

The input schema has 0% description coverage, so the description must compensate. It adds meaning by explaining that 'sample_size' controls how many rows to return and specifies a default value of 10, which isn't in the schema. For 'table_name', it clarifies it refers to 'the specified table in the Azure Data Explorer database,' providing context beyond the schema's bare type. With 2 parameters and no schema descriptions, this is strong but not exhaustive (e.g., no constraints on sample_size range).

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 tool's purpose with specific verbs ('Retrieves a random sample of rows') and resources ('from the specified table in the Azure Data Explorer database'). It distinguishes itself from siblings like 'execute_query' (which likely runs custom queries) and 'get_table_details/schema' (which return metadata rather than data). However, it doesn't explicitly contrast with 'list_tables' (which lists tables rather than sampling data), keeping it from a perfect score.

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

Usage Guidelines3/5

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

The description implies usage by mentioning 'random sample' and a default sample size, suggesting it's for exploratory data analysis. However, it lacks explicit guidance on when to use this tool versus alternatives like 'execute_query' for custom filtering or 'get_table_details' for metadata. No exclusions or prerequisites are stated, leaving the agent to infer context from the tool's name and description alone.

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/pab1it0/adx-mcp-server'

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