From 593ab5da54237169012daf9eabc714f467248081 Mon Sep 17 00:00:00 2001 From: Jaakko Tiistola Date: Sun, 31 May 2026 09:01:50 -0700 Subject: [PATCH] Add anti-guessing hint to execute_sql_query MCP tool description The execute_sql_query docstring is surfaced verbatim as the MCP tool description, but it lists only a few example columns and never tells the model to confirm the schema first. With daily_health_metrics carrying 50+ columns, memoryless LLM clients extrapolate column names and hit "no such column" errors. The sibling tools (get_table_details, explore_database_structure) already point forward ("use me first"); this adds the missing backward pointer from execute_sql_query to get_table_details plus an explicit "do NOT guess". Docstring-only -- no logic or behavior change; re-exports on server reload. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/garmy/mcp/server.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/garmy/mcp/server.py b/src/garmy/mcp/server.py index 6fb67f4..b9c8955 100644 --- a/src/garmy/mcp/server.py +++ b/src/garmy/mcp/server.py @@ -317,6 +317,10 @@ def execute_sql_query( IMPORTANT: Only SELECT and WITH queries are allowed for security. + Column names are non-obvious (daily_health_metrics alone has 50+ columns) — + call get_table_details(table_name) to confirm exact names before querying; + do NOT guess. + Args: query: SQL SELECT query (e.g., "SELECT metric_date, total_steps FROM daily_health_metrics WHERE user_id = 1") params: Optional list of parameters for ? placeholders in query