Skip to main content
Glama
StarRocks

StarRocks MCP Server

Official

read_query

Execute SELECT queries or commands to retrieve ResultSets directly from StarRocks databases via the MCP Server, enabling efficient SQL execution and database exploration without complex setup.

Instructions

Execute a SELECT query or commands that return a ResultSet

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSQL query to execute

Implementation Reference

  • The handler function for the 'read_query' tool. Decorated with @mcp.tool for registration. Defines input schema using Annotated and Field for query (required SQL string) and optional db. Executes the query via db_client.execute, logs results, and returns a ToolResult with textual representation (limited to 10000 chars) and structured dict of the result set.
    @mcp.tool(description="Execute a SELECT query or commands that return a ResultSet" + description_suffix)
    def read_query(query: Annotated[str, Field(description="SQL query to execute")],
                   db: Annotated[str|None, Field(description="database")] = None) -> ToolResult:
        # return csv like result set, with column names as first row
        logger.info(f"Executing read query: {query[:100]}{'...' if len(query) > 100 else ''}")
        result = db_client.execute(query, db=db)
        if result.success:
            logger.info(f"Query executed successfully, returned {len(result.rows) if result.rows else 0} rows")
        else:
            logger.error(f"Query failed: {result.error_message}")
        return ToolResult(content=[TextContent(type='text', text=result.to_string(limit=10000))],
                          structured_content=result.to_dict())
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 tool executes queries and returns a ResultSet, but fails to address critical aspects like authentication requirements, rate limits, error handling, or whether it supports transactions. This leaves significant gaps for an agent to understand the tool's 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 functionality ('Execute a SELECT query or commands') and specifies the outcome ('return a ResultSet'). There is no wasted wording, 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.

Completeness3/5

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

Given the tool's moderate complexity (executing SQL queries), lack of annotations, and no output schema, the description is incomplete. It covers the basic purpose but omits details on result format, error cases, or operational constraints, which are essential for safe and effective use by an agent.

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 schema description coverage is 100%, with the single parameter 'query' well-documented in the schema. The description adds no additional meaning beyond what the schema provides, such as query syntax examples or supported SQL dialects, so it meets the baseline score of 3.

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 ('Execute a SELECT query or commands') and identifies the resource ('ResultSet'). It distinguishes from write operations but doesn't explicitly differentiate from all sibling tools like 'analyze_query' or 'query_and_plotly_chart', which prevents 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 for read-only SQL queries that return results, suggesting when to use it (for SELECT queries) but not explicitly when not to use it or what alternatives exist among siblings like 'write_query' for mutations. This provides some context but lacks comprehensive guidance.

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

Related 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/StarRocks/mcp-server-starrocks'

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