From 67f18ef3c92d345a756e0ce307e7222a83c4c046 Mon Sep 17 00:00:00 2001 From: Fahad Date: Tue, 10 Jun 2025 11:43:47 +0400 Subject: [PATCH] refactor: rename debug_issue tool to debug for brevity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rename debug_issue.py to debug.py - Update tool name from 'debug_issue' to 'debug' throughout codebase - Update all references in server.py, tests, and README - Keep DebugIssueTool class name for backward compatibility - All tests pass with the renamed tool This makes the tool name shorter and more consistent with other tool names like 'chat' and 'analyze'. The functionality remains exactly the same. 🤖 Generated with Claude Code Co-Authored-By: Claude --- README.md | 22 +++++++++++----------- server.py | 2 +- tests/test_collaboration.py | 6 +++--- tests/test_large_prompt_handling.py | 10 +++++----- tests/test_prompt_regression.py | 6 +++--- tests/test_server.py | 2 +- tests/test_thinking_modes.py | 2 +- tests/test_tools.py | 8 ++++---- tools/__init__.py | 2 +- tools/{debug_issue.py => debug.py} | 4 ++-- 10 files changed, 32 insertions(+), 32 deletions(-) rename tools/{debug_issue.py => debug.py} (99%) diff --git a/README.md b/README.md index 5a63e65..02bf39b 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ The ultimate development partner for Claude - a Model Context Protocol server th - [`think_deeper`](#2-think_deeper---extended-reasoning-partner) - Extended reasoning - [`review_code`](#3-review_code---professional-code-review) - Code review - [`review_changes`](#4-review_changes---pre-commit-validation) - Pre-commit validation - - [`debug_issue`](#5-debug_issue---expert-debugging-assistant) - Debugging help + - [`debug`](#5-debug---expert-debugging-assistant) - Debugging help - [`analyze`](#6-analyze---smart-file-analysis) - File analysis - **Advanced Topics** @@ -44,7 +44,7 @@ Claude is brilliant, but sometimes you need: - **A second opinion** on complex architectural decisions - augment Claude's extended thinking with Gemini's perspective ([`think_deeper`](#2-think_deeper---extended-reasoning-partner)) - **Professional code reviews** with actionable feedback across entire repositories ([`review_code`](#3-review_code---professional-code-review)) - **Pre-commit validation** with deep analysis that finds edge cases, validates your implementation against original requirements, and catches subtle bugs Claude might miss ([`review_changes`](#4-review_changes---pre-commit-validation)) -- **Expert debugging** for tricky issues with full system context ([`debug_issue`](#5-debug_issue---expert-debugging-assistant)) +- **Expert debugging** for tricky issues with full system context ([`debug`](#5-debug---expert-debugging-assistant)) - **Massive context window** (1M tokens) - Gemini 2.5 Pro can analyze entire codebases, read hundreds of files at once, and provide comprehensive insights ([`analyze`](#6-analyze---smart-file-analysis)) - **Deep code analysis** across massive codebases that exceed Claude's context limits ([`analyze`](#6-analyze---smart-file-analysis)) - **Dynamic collaboration** - Gemini can request additional context from Claude mid-analysis for more thorough insights @@ -325,7 +325,7 @@ Replace `/path/to/gemini-mcp-server` with the actual path where you cloned the r Just ask Claude naturally: - "Use gemini to think deeper about this architecture design" → `think_deeper` - "Get gemini to review this code for security issues" → `review_code` -- "Get gemini to debug why this test is failing" → `debug_issue` +- "Get gemini to debug why this test is failing" → `debug` - "Use gemini to analyze these files to understand the data flow" → `analyze` - "Brainstorm with gemini about scaling strategies" → `chat` - "Share my implementation plan with gemini for feedback" → `chat` @@ -338,7 +338,7 @@ Just ask Claude naturally: - **Need deeper thinking?** → `think_deeper` (extends Claude's analysis, finds edge cases) - **Code needs review?** → `review_code` (bugs, security, performance issues) - **Pre-commit validation?** → `review_changes` (validate git changes before committing) -- **Something's broken?** → `debug_issue` (root cause analysis, error tracing) +- **Something's broken?** → `debug` (root cause analysis, error tracing) - **Want to understand code?** → `analyze` (architecture, patterns, dependencies) - **Server info?** → `get_version` (version and configuration details) @@ -451,7 +451,7 @@ If you prefer to use WSL (Windows Subsystem for Linux): 2. [`think_deeper`](#2-think_deeper---extended-reasoning-partner) - Extended reasoning and problem-solving 3. [`review_code`](#3-review_code---professional-code-review) - Professional code review with severity levels 4. [`review_changes`](#4-review_changes---pre-commit-validation) - Validate git changes before committing -5. [`debug_issue`](#5-debug_issue---expert-debugging-assistant) - Root cause analysis and debugging +5. [`debug`](#5-debug---expert-debugging-assistant) - Root cause analysis and debugging 6. [`analyze`](#6-analyze---smart-file-analysis) - General-purpose file and code analysis 7. [`get_version`](#7-get_version---server-information) - Get server version and configuration @@ -664,7 +664,7 @@ implementations or missing test coverage. Update the code based on gemini's find **Triggers:** review pending changes, check my changes, validate changes, pre-commit review -### 5. `debug_issue` - Expert Debugging Assistant +### 5. `debug` - Expert Debugging Assistant **Root cause analysis for complex problems** **Thinking Mode:** Default is `medium` (8,192 tokens). Use `high` for tricky bugs (investment in finding root cause) or `low` for simple errors (save tokens). @@ -809,7 +809,7 @@ All tools that work with files support **both individual files and entire direct "Get gemini to review src/ with focus on performance, only show critical issues" ``` -**`debug_issue`** - Debug with file context +**`debug`** - Debug with file context - `error_description`: Description of the issue (required) - `error_context`: Stack trace or logs - `files`: Files or directories related to the issue @@ -864,7 +864,7 @@ The server recognizes natural phrases. Just talk normally: ### Automatic Tool Selection Claude will automatically pick the right tool based on your request: - "review" → `review_code` -- "debug" → `debug_issue` +- "debug" → `debug` - "analyze" → `analyze` - "think deeper" → `think_deeper` @@ -882,7 +882,7 @@ Tools can reference files for additional context: To help choose the right tool for your needs: **Decision Flow:** -1. **Have a specific error/exception?** → Use `debug_issue` +1. **Have a specific error/exception?** → Use `debug` 2. **Want to find bugs/issues in code?** → Use `review_code` 3. **Want to understand how code works?** → Use `analyze` 4. **Have analysis that needs extension/validation?** → Use `think_deeper` @@ -891,7 +891,7 @@ To help choose the right tool for your needs: **Key Distinctions:** - `analyze` vs `review_code`: analyze explains, review_code prescribes fixes - `chat` vs `think_deeper`: chat is open-ended, think_deeper extends specific analysis -- `debug_issue` vs `review_code`: debug diagnoses runtime errors, review finds static issues +- `debug` vs `review_code`: debug diagnoses runtime errors, review finds static issues ## Thinking Modes - Managing Token Costs & Quality @@ -1096,7 +1096,7 @@ The server uses carefully crafted system prompts to give each tool specialized e Each tool has a unique system prompt that defines its role and approach: - **`think_deeper`**: Acts as a senior development partner, challenging assumptions and finding edge cases - **`review_code`**: Expert code reviewer with security/performance focus, uses severity levels -- **`debug_issue`**: Systematic debugger providing root cause analysis and prevention strategies +- **`debug`**: Systematic debugger providing root cause analysis and prevention strategies - **`analyze`**: Code analyst focusing on architecture, patterns, and actionable insights ### Customization diff --git a/server.py b/server.py index 175c356..2153439 100644 --- a/server.py +++ b/server.py @@ -61,7 +61,7 @@ server: Server = Server("gemini-server") TOOLS = { "think_deeper": ThinkDeeperTool(), # Extended reasoning for complex problems "review_code": ReviewCodeTool(), # Comprehensive code review and quality analysis - "debug_issue": DebugIssueTool(), # Root cause analysis and debugging assistance + "debug": DebugIssueTool(), # Root cause analysis and debugging assistance "analyze": AnalyzeTool(), # General-purpose file and code analysis "chat": ChatTool(), # Interactive development chat and brainstorming "review_changes": ReviewChanges(), # Pre-commit review of git changes diff --git a/tests/test_collaboration.py b/tests/test_collaboration.py index 6f8ed2a..8d653c9 100644 --- a/tests/test_collaboration.py +++ b/tests/test_collaboration.py @@ -8,7 +8,7 @@ from unittest.mock import Mock, patch import pytest from tools.analyze import AnalyzeTool -from tools.debug_issue import DebugIssueTool +from tools.debug import DebugIssueTool from tools.models import ClarificationRequest, ToolOutput @@ -122,7 +122,7 @@ class TestDynamicContextRequests: "question": "I need to see the database configuration to diagnose the connection error", "files_needed": ["config/database.yml", "src/db.py"], "suggested_next_action": { - "tool": "debug_issue", + "tool": "debug", "args": { "error_description": "Connection timeout to database", "files": [ @@ -155,7 +155,7 @@ class TestDynamicContextRequests: clarification = json.loads(response_data["content"]) assert "suggested_next_action" in clarification - assert clarification["suggested_next_action"]["tool"] == "debug_issue" + assert clarification["suggested_next_action"]["tool"] == "debug" def test_tool_output_model_serialization(self): """Test ToolOutput model serialization""" diff --git a/tests/test_large_prompt_handling.py b/tests/test_large_prompt_handling.py index 37a6972..c314041 100644 --- a/tests/test_large_prompt_handling.py +++ b/tests/test_large_prompt_handling.py @@ -18,7 +18,7 @@ from mcp.types import TextContent from config import MCP_PROMPT_SIZE_LIMIT from tools.analyze import AnalyzeTool from tools.chat import ChatTool -from tools.debug_issue import DebugIssueTool +from tools.debug import DebugIssueTool from tools.review_changes import ReviewChanges from tools.review_code import ReviewCodeTool from tools.think_deeper import ThinkDeeperTool @@ -167,8 +167,8 @@ class TestLargePromptHandling: assert output["status"] == "requires_file_prompt" @pytest.mark.asyncio - async def test_debug_issue_large_error_description(self, large_prompt): - """Test that debug_issue tool detects large error_description.""" + async def test_debug_large_error_description(self, large_prompt): + """Test that debug tool detects large error_description.""" tool = DebugIssueTool() result = await tool.execute({"error_description": large_prompt}) @@ -177,8 +177,8 @@ class TestLargePromptHandling: assert output["status"] == "requires_file_prompt" @pytest.mark.asyncio - async def test_debug_issue_large_error_context(self, large_prompt, normal_prompt): - """Test that debug_issue tool detects large error_context.""" + async def test_debug_large_error_context(self, large_prompt, normal_prompt): + """Test that debug tool detects large error_context.""" tool = DebugIssueTool() result = await tool.execute({"error_description": normal_prompt, "error_context": large_prompt}) diff --git a/tests/test_prompt_regression.py b/tests/test_prompt_regression.py index 27c399a..ad63ca9 100644 --- a/tests/test_prompt_regression.py +++ b/tests/test_prompt_regression.py @@ -12,7 +12,7 @@ import pytest from tools.analyze import AnalyzeTool from tools.chat import ChatTool -from tools.debug_issue import DebugIssueTool +from tools.debug import DebugIssueTool from tools.review_changes import ReviewChanges from tools.review_code import ReviewCodeTool from tools.think_deeper import ThinkDeeperTool @@ -167,8 +167,8 @@ class TestPromptRegression: assert output["status"] == "success" @pytest.mark.asyncio - async def test_debug_issue_normal_error(self, mock_model_response): - """Test debug_issue tool with normal error description.""" + async def test_debug_normal_error(self, mock_model_response): + """Test debug tool with normal error description.""" tool = DebugIssueTool() with patch.object(tool, "create_model") as mock_create_model: diff --git a/tests/test_server.py b/tests/test_server.py index e092359..3a78088 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -21,7 +21,7 @@ class TestServerTools: # Check all core tools are present assert "think_deeper" in tool_names assert "review_code" in tool_names - assert "debug_issue" in tool_names + assert "debug" in tool_names assert "analyze" in tool_names assert "chat" in tool_names assert "review_changes" in tool_names diff --git a/tests/test_thinking_modes.py b/tests/test_thinking_modes.py index 6791dcf..f1d2883 100644 --- a/tests/test_thinking_modes.py +++ b/tests/test_thinking_modes.py @@ -7,7 +7,7 @@ from unittest.mock import Mock, patch import pytest from tools.analyze import AnalyzeTool -from tools.debug_issue import DebugIssueTool +from tools.debug import DebugIssueTool from tools.review_code import ReviewCodeTool from tools.think_deeper import ThinkDeeperTool diff --git a/tests/test_tools.py b/tests/test_tools.py index f022893..e8a1b97 100644 --- a/tests/test_tools.py +++ b/tests/test_tools.py @@ -103,7 +103,7 @@ class TestReviewCodeTool: class TestDebugIssueTool: - """Test the debug_issue tool""" + """Test the debug tool""" @pytest.fixture def tool(self): @@ -111,7 +111,7 @@ class TestDebugIssueTool: def test_tool_metadata(self, tool): """Test tool metadata""" - assert tool.get_name() == "debug_issue" + assert tool.get_name() == "debug" assert "DEBUG & ROOT CAUSE ANALYSIS" in tool.get_description() assert tool.get_default_temperature() == 0.2 @@ -232,8 +232,8 @@ class TestAbsolutePathValidation: assert "../parent/file.py" in response["content"] @pytest.mark.asyncio - async def test_debug_issue_tool_relative_path_rejected(self): - """Test that debug_issue tool rejects relative paths""" + async def test_debug_tool_relative_path_rejected(self): + """Test that debug tool rejects relative paths""" tool = DebugIssueTool() result = await tool.execute( { diff --git a/tools/__init__.py b/tools/__init__.py index e9c4a7d..98f2de5 100644 --- a/tools/__init__.py +++ b/tools/__init__.py @@ -4,7 +4,7 @@ Tool implementations for Gemini MCP Server from .analyze import AnalyzeTool from .chat import ChatTool -from .debug_issue import DebugIssueTool +from .debug import DebugIssueTool from .review_changes import ReviewChanges from .review_code import ReviewCodeTool from .think_deeper import ThinkDeeperTool diff --git a/tools/debug_issue.py b/tools/debug.py similarity index 99% rename from tools/debug_issue.py rename to tools/debug.py index fc00873..93ccdbb 100644 --- a/tools/debug_issue.py +++ b/tools/debug.py @@ -16,7 +16,7 @@ from .models import ToolOutput class DebugIssueRequest(ToolRequest): - """Request model for debug_issue tool""" + """Request model for debug tool""" error_description: str = Field(..., description="Error message, symptoms, or issue description") error_context: Optional[str] = Field(None, description="Stack trace, logs, or additional error context") @@ -32,7 +32,7 @@ class DebugIssueTool(BaseTool): """Advanced debugging and root cause analysis tool""" def get_name(self) -> str: - return "debug_issue" + return "debug" def get_description(self) -> str: return (