Skip to main content
Glama
gigapi

GigAPI MCP Server

by gigapi

run_select_query

Execute SQL queries on GigAPI Timeseries Lake clusters to retrieve and analyze time-series data from specified databases.

Instructions

Execute SQL queries on your GigAPI cluster. All queries are executed safely.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYes
databaseYes

Implementation Reference

  • The core handler function that executes the provided SQL SELECT query on the specified GigAPI database using the client.execute_query method. It handles errors from the client response or exceptions, and returns a structured dictionary with results, success status, query, and database information.
    def run_select_query(self, sql: str, database: str) -> Dict[str, Any]:
        """Execute SQL query on GigAPI.
    
        Args:
            sql: The SQL query to execute
            database: The database to execute the query against
    
        Returns:
            Query results
        """
        try:
            response = self.client.execute_query(sql, database)
    
            if response.error:
                return {
                    "error": response.error,
                    "success": False
                }
    
            return {
                "results": response.results,
                "success": True,
                "query": sql,
                "database": database
            }
        except GigAPIClientError as e:
            logger.error(f"Query execution failed: {e}")
            return {
                "error": str(e),
                "success": False,
                "query": sql,
                "database": database
            }
  • Pydantic BaseModel defining the input schema for the run_select_query tool, specifying 'sql' (required SQL query string) and 'database' (required database name) fields with descriptions.
    class QueryInput(BaseModel):
        """Input model for SQL query execution."""
    
        sql: str = Field(..., description="The SQL query to execute")
        database: str = Field(..., description="The database to execute the query against")
  • Registration of the 'run_select_query' tool in the create_tools function using FastMCP's Tool.from_function. It binds the GigAPITools instance's run_select_query method, assigns the tool name, and provides a description emphasizing safe SQL query execution.
    Tool.from_function(
        tools_instance.run_select_query,
        name="run_select_query",
        description="Execute SQL queries on your GigAPI cluster. All queries are executed safely.",
    ),
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions 'safely' but doesn't explain what this means (e.g., read-only, timeouts, result limits, authentication requirements, or error handling). For a database query tool with zero annotation coverage, this leaves critical behavioral traits undocumented.

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 appropriately concise with two sentences. The first sentence states the core functionality, and the second adds a safety qualification. There's no unnecessary verbiage, though the safety claim could be more informative.

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 complexity of SQL execution, zero annotation coverage, 0% schema description coverage, and no output schema, the description is inadequate. It doesn't explain return formats, error conditions, performance characteristics, or connection details. For a tool that executes arbitrary SQL, this leaves too many unknowns for reliable agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the schema provides no parameter documentation. The description doesn't add any parameter semantics beyond what's in the property names ('sql', 'database'). It doesn't explain SQL syntax requirements, database identifier formats, or provide examples. The description fails to compensate for the complete lack of schema documentation.

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 verb 'Execute' and resource 'SQL queries on your GigAPI cluster', making the purpose understandable. It distinguishes from siblings like 'write_data' by specifying 'queries' (typically read operations), though it doesn't explicitly differentiate from other query-related tools like 'get_table_schema'.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to choose 'run_select_query' over 'write_data' for data manipulation, or when to use 'list_tables'/'get_table_schema' for metadata exploration instead. The 'safely' hint is vague and doesn't constitute actionable usage 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

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/gigapi/gigapi-mcp'

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