Skip to main content
Glama
alaturqua

MCP Trino Server

by alaturqua

show_query_history

Retrieve executed query history to audit data access, analyze performance patterns, and troubleshoot Trino operations.

Instructions

Get the history of executed queries

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNomaximum number of history entries to return

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main tool handler function decorated with @mcp.tool. Takes an optional 'limit' parameter and returns query history as a JSON string by calling client.get_query_history().
    @mcp.tool(name="show_query_history", description="Get the history of executed queries")
    def show_query_history(
        limit: int = Field(description="maximum number of history entries to return", default=None),
    ) -> str:
        """Get the history of executed queries.
    
        Args:
            limit: maximum number of history entries to return.
                If None, returns all entries.
    
        Returns:
            str: JSON-formatted string containing query history.
        """
        return client.get_query_history(limit)
  • Helper method that constructs and executes the SQL query to fetch query history from system.runtime.queries. Adds LIMIT clause if specified.
    def get_query_history(self, limit: int) -> str:
        """Retrieve the history of executed queries.
    
        Args:
            limit (Optional[int]): Maximum number of queries to return. If None, returns all queries.
    
        Returns:
            str: JSON-formatted string containing query history.
        """
        query = "SELECT * FROM system.runtime.queries"
        if limit is not None:
            query += f" LIMIT {limit}"
        return self.execute_query(query)
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 of behavioral disclosure. It doesn't indicate whether this is read-only (implied but not stated), how far back history extends, whether failed queries are included, or performance characteristics of retrieving history.

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

Conciseness3/5

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

The single sentence is front-loaded and free of redundancy, but given the lack of annotations and numerous siblings, it is undersized. The brevity comes at the cost of necessary context rather than efficient communication.

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?

While the existence of an output schema reduces the need to describe return values, and the single parameter is well-documented in schema, the description lacks domain context. It doesn't clarify how this differs from table history or metadata logs, which is essential given the sibling tool names.

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 for the 'limit' parameter. The description adds no additional context about parameter usage, default behavior when limit is omitted, or valid ranges, warranting the baseline score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the basic function (getting query execution history) with a clear verb and resource, but fails to distinguish from siblings like 'show_table_history' or 'show_metadata_log_entries'. It doesn't clarify what 'queries' refers to (SQL statements vs. system queries) or the scope of history available.

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 guidance provided on when to use this versus alternatives like 'execute_query' (which executes) or other 'show_' commands. No prerequisites or conditions mentioned.

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/alaturqua/mcp-trino-python'

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