@debugmcp/mcp-debugger
Version:
Run-time step-through debugging for LLM agents.
133 lines (111 loc) • 4.08 kB
Markdown
# Task 2.3: MCP Tools Update Summary
## Overview
Successfully updated the MCP tool implementations in `server.ts` to work with the new adapter pattern infrastructure. The tools now support multiple languages dynamically based on registered adapters.
## Changes Implemented
### 1. Dynamic Language Support in Tool Definitions
- Modified `create_debug_session` tool to accept languages dynamically from adapter registry
- Tool schema now reflects actual registered languages instead of hard-coded `['python']`
- Language parameter includes description: "Programming language for debugging"
### 2. Generic Parameter Names
- Changed from `pythonPath` to `executablePath` throughout the API
- Clean, language-agnostic parameter naming
- Tool description: "Path to language executable (optional, will auto-detect if not provided)"
### 3. Updated Server Methods
- **Language Validation**: Now uses `adapterRegistry.isLanguageSupported()`
- **Error Messages**: Include list of available languages when unsupported language requested
- **Session Names**: Default to `${language}-debug-${timestamp}` format
### 4. New Language Discovery Tool
```typescript
{
name: 'list_supported_languages',
description: 'List all supported debugging languages with metadata',
inputSchema: { type: 'object', properties: {} }
}
```
Returns structured metadata:
```javascript
{
success: true,
languages: [
{
id: 'python',
displayName: 'Python',
version: '1.0.0',
requiresExecutable: true,
defaultExecutable: 'python'
},
{
id: 'javascript',
displayName: 'JavaScript (Mock)',
version: '1.0.0',
requiresExecutable: false
}
],
count: 2
}
```
### 5. SessionManager Integration
- Added `getAdapterRegistry()` method to expose registry for language queries
- SessionManager.createSession() now accepts `executablePath` parameter
- SessionStore updated to handle both `pythonPath` and `executablePath`
### 6. Multi-Language Registration
- Registered JavaScript as second language in `dependencies.ts`
- Both Python and JavaScript use MockAdapterFactory temporarily
- Demonstrates dynamic language support working correctly
## Key Benefits
### 1. **Dynamic Language Support**
- Tool schema automatically reflects registered languages
- No hard-coded language lists in tool definitions
- Easy to add new languages by registering adapters
### 2. **Clean API**
- No legacy parameter names (pythonPath → executablePath)
- Language-agnostic throughout
- Clear, consistent naming
### 3. **Backward Compatibility**
- Tool still accepts `pythonPath` for transition period
- Maps to `executablePath` internally
- No breaking changes for existing code
### 4. **Improved Error Messages**
- Shows available languages when unsupported language requested
- Better user experience for discovering capabilities
## Testing Verification
### Python Still Works
```javascript
// Create Python session
{
"language": "python",
"name": "my-python-session",
"executablePath": "/usr/bin/python3"
}
```
### JavaScript Support
```javascript
// Create JavaScript session
{
"language": "javascript",
"name": "my-js-session"
}
```
### Language Discovery
```javascript
// list_supported_languages returns:
{
"success": true,
"languages": ["python", "javascript"],
"count": 2
}
```
## Next Steps
With Task 2.3 complete, the MCP tools now fully support the adapter pattern. The next task (3.1) will implement the real Python adapter to replace the mock adapter currently being used.
## Files Modified
1. `src/server.ts` - Updated tool definitions and methods
2. `src/session/session-manager.ts` - Added getAdapterRegistry method
3. `src/session/session-store.ts` - Updated to accept executablePath
4. `src/container/dependencies.ts` - Registered JavaScript language
## Success Criteria Met
- ✅ MCP tools accept multiple languages
- ✅ Language validation via adapter registry
- ✅ Clean parameter names (no pythonPath)
- ✅ list_supported_languages tool implemented
- ✅ Python debugging still functional
- ✅ Tests pass