Skip to main content
Glama
StarRocks

StarRocks MCP Server

Official

write_query

Execute DDL/DML or other StarRocks commands without a ResultSet, enabling direct SQL operations on the StarRocks database through the MCP server interface.

Instructions

Execute a DDL/DML or other StarRocks command that do not have a ResultSet

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSQL to execute

Implementation Reference

  • The complete implementation of the 'write_query' tool handler, including decorator (registration and schema), function definition, execution logic using db_client.execute for non-SELECT queries, logging, and returning ToolResult with results.
    @mcp.tool(description="Execute a DDL/DML or other StarRocks command that do not have a ResultSet" + description_suffix)
    def write_query(query: Annotated[str, Field(description="SQL to execute")],
                    db: Annotated[str|None, Field(description="database")] = None) -> ToolResult:
        logger.info(f"Executing write query: {query[:100]}{'...' if len(query) > 100 else ''}")
        result = db_client.execute(query, db=db)
        if not result.success:
            logger.error(f"Write query failed: {result.error_message}")
        elif result.rows_affected is not None and result.rows_affected >= 0:
            logger.info(f"Write query executed successfully, {result.rows_affected} rows affected in {result.execution_time:.2f}s")
        else:
            logger.info(f"Write query executed successfully in {result.execution_time:.2f}s")
        return ToolResult(content=[TextContent(type='text', text=result.to_string(limit=2000))],
                          structured_content=result.to_dict())
Behavior2/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 mentions the tool executes commands, implying mutation/write operations, but doesn't disclose critical behavioral traits such as permissions required, whether changes are reversible, error handling, or rate limits. The 'no ResultSet' constraint is useful but insufficient for a mutation tool with zero annotation coverage.

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 clearly states the tool's function and key constraint. It's front-loaded with essential information and has no wasted words, making it highly concise and well-structured for quick understanding.

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 the tool's complexity (executes DDL/DML commands, implying mutations), lack of annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like side effects, error responses, or prerequisites, which are crucial for safe usage. The 'no ResultSet' hint is helpful but insufficient to compensate for these 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?

The input schema has 100% description coverage, with the 'query' parameter documented as 'SQL to execute.' The description adds minimal value beyond this, as it doesn't elaborate on syntax, supported commands, or examples. With high schema coverage, the baseline is 3, and the description meets but doesn't exceed this by providing additional parameter insights.

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: 'Execute a DDL/DML or other StarRocks command that do not have a ResultSet.' It specifies the action (execute), the type of commands (DDL/DML/other StarRocks commands), and a key constraint (no ResultSet). However, it doesn't explicitly differentiate from siblings like 'read_query' or 'analyze_query' beyond the ResultSet distinction.

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 DDL/DML or commands without ResultSets, which suggests when to use it (e.g., for writes or administrative tasks) versus alternatives like 'read_query' (for queries with ResultSets). However, it lacks explicit guidance on when-not-to-use or named alternatives, leaving some ambiguity about overlap with siblings like 'analyze_query' or 'query_and_plotly_chart'.

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