Skip to main content
Glama

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

NameRequiredDescriptionDefault
queryYesSQL query to execute

Input Schema (JSON Schema)

{ "properties": { "query": { "description": "SQL query to execute", "title": "Query", "type": "string" } }, "required": [ "query" ], "type": "object" }

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())

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