You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: graceful degradation when GEMINI_API_KEY is missing
Tools that require Gemini (find_patterns, trace_dataflow, semantic
analysis) now check for the key upfront and return a helpful error
with setup instructions instead of a cryptic crash. Tells users
exactly how to add the env var to their MCP config.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@@ -70641,6 +70659,21 @@ var findPatternsSchema = {
70641
70659
patternTypes: exports_external.array(exports_external.string()).optional().describe(`Optional: specific patterns to look for. Available: ${DETECTABLE_PATTERNS.join(", ")}`)
70642
70660
};
70643
70661
async function executeFindPatterns(input) {
70662
+
if (!hasGeminiKey()) {
70663
+
throw new Error(`find_patterns requires GEMINI_API_KEY for AI-powered pattern detection.
70664
+
70665
+
` + `To set it up, add the env var to your MCP server config in ~/.mcp.json:
70666
+
70667
+
` + ` "codebase-analyzer": {
70668
+
` + ` "command": "npx",
70669
+
` + ` "args": ["-y", "codebase-analyzer-mcp"],
70670
+
` + ` "env": { "GEMINI_API_KEY": "your_key" }
70671
+
` + ` }
70672
+
70673
+
` + `Get a free key at https://aistudio.google.com/apikey
70674
+
70675
+
` + "Alternatively, use analyze_repo (free, no API key needed) or query_repo (degrades gracefully without Gemini).");
0 commit comments