Skip to main content
Glama
StarRocks

StarRocks MCP Server

Official

read_query

Execute SQL SELECT queries on StarRocks databases to retrieve data and return the result set.

Instructions

Execute a SELECT query or commands that return a ResultSet

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSQL query to execute
dbNodatabase

Implementation Reference

  • The tool handler: decorated with @mcp.tool, defines the 'read_query' tool. It takes a SQL query and optional database, executes it via db_client.execute(), and returns a ToolResult with text and structured content.
    @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())
  • The registration decorator @mcp.tool registers 'read_query' as an MCP tool with a description. FastMCP's @mcp.tool automatically registers the function name as the tool name.
    @mcp.tool(description="Execute a SELECT query or commands that return a ResultSet" + description_suffix)
  • Input schema: 'query' is a required string with description 'SQL query to execute', and 'db' is an optional string (str|None) with description 'database'. Defined using Annotated and Pydantic Field.
    def read_query(query: Annotated[str, Field(description="SQL query to execute")],
                   db: Annotated[str|None, Field(description="database")] = None) -> ToolResult:
  • The db_client used by read_query is obtained via get_db_client() which provides the execute() method.
    db_client = get_db_client()
Behavior2/5

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

No annotations provided, and the description does not mention behavioral traits such as safety (read-only), authentication needs, rate limits, or result size constraints. The phrase 'commands that return a ResultSet' hints at non-modification but is insufficient for full transparency.

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

Conciseness4/5

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

The description is a single front-loaded sentence with no wasted words. It could be slightly expanded to include usage context without losing conciseness.

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?

The description is minimal for a tool with no output schema and no annotations. It lacks information about return value format, error behavior, and more detailed usage context. Adequate but with clear gaps.

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?

Schema coverage is 100%, so the base score is 3. The description adds no extra meaning beyond what the schema already provides for the two parameters. No additional syntax, constraints, or format details are given.

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 executes SELECT queries or commands returning a ResultSet. This distinguishes it from write_query, though it could be more explicit about read-only nature. The purpose is clear with specific verb and resource.

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?

No explicit guidance on when to use this tool versus siblings like analyze_query or db_summary. The description implies it's for read queries, but lacks when-not-to-use, prerequisites, or alternatives 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/StarRocks/mcp-server-starrocks'

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