Skip to main content
Glama
andreadecorte

GABI MCP Server

get_query_result

Execute SQL queries on a single line to retrieve data from the current database. Use this tool to run queries against a target endpoint with proper authentication.

Instructions

Executes an SQL query on a single line against the current database.

Args: query

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes

Implementation Reference

  • gabi.py:74-74 (registration)
    The @mcp.tool() decorator registers the get_query_result tool with the MCP server.
    @mcp.tool()
  • gabi.py:75-80 (handler)
    The handler function that executes the tool logic by making a POST request to the GABI /query endpoint with the provided SQL query.
    async def get_query_result(query: str) -> str:
        """Executes an SQL query on a single line against the current database.
    
        Args: query
        """
        return await make_gabi_post_request(build_gabi_url("/query"), query)
  • gabi.py:46-65 (helper)
    Helper function used by get_query_result to perform the actual HTTP POST request to the GABI API.
    async def make_gabi_post_request(url: str, query: str) -> dict[str, Any] | None:
        """Make a POST request to GABI."""
        headers = {}
        try:
            headers = build_headers()
        except KeyError:
            return "ERROR: token not defined!"
    
        data = {
            "query": query
        }
    
        async with httpx.AsyncClient() as client:
            try:
                response = await client.post(url, headers=headers, timeout=30.0, json=data)
                response.raise_for_status()
                return response.json()
            except Exception as e:
                return e
  • gabi.py:14-17 (helper)
    Helper to construct the GABI endpoint URL.
    def build_gabi_url(path: str) -> str:
        """Build the endpoint for GABI"""
        return os.environ.get("GABI_ENDPOINT") + path
  • gabi.py:22-28 (helper)
    Helper to build HTTP headers including authorization token.
    def build_headers() -> dict:
        """Build headers for HTTP requests"""
        return {
            "User-Agent": USER_AGENT,
            "Authorization": f"Bearer {get_access_token()}",
            "Content-Type": "application/json"
        }
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/andreadecorte/gabi-mcp'

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