UNPKG

@debugmcp/mcp-debugger

Version:

Run-time step-through debugging for LLM agents.

75 lines 3.08 kB
import { MockDebugAdapter } from './mock-debug-adapter.js'; import { DebugLanguage } from '../../session/models.js'; /** * Factory for creating mock debug adapter instances */ export class MockAdapterFactory { config; constructor(config = {}) { this.config = config; } /** * Create a new mock adapter instance */ createAdapter(dependencies) { return new MockDebugAdapter(dependencies, this.config); } /** * Get metadata about the mock adapter */ getMetadata() { return { language: DebugLanguage.MOCK, displayName: 'Mock Debug Adapter', version: '1.0.0', author: 'MCP Debugger Team', description: 'Mock debug adapter for testing the MCP debugger without external dependencies', documentationUrl: 'https://github.com/debugmcp/mcp-debugger/docs/mock-adapter', minimumDebuggerVersion: '2.0.0', fileExtensions: ['.mock', '.test'], icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyIDJDNi40OCAyIDIgNi40OCAyIDEyUzYuNDggMjIgMTIgMjJTMjIgMTcuNTIgMjIgMTJTMTcuNTIgMiAxMiAyWk0xMiAyMEM4LjEzIDIwIDUgMTYuODcgNSAxMlM4LjEzIDQgMTIgNFMxOSA3LjEzIDE5IDEyUzE1Ljg3IDIwIDEyIDIwWk0xMiA2QzkuNzkgNiA4IDcuNzkgOCAxMFM5Ljc5IDE0IDEyIDE0UzE2IDEyLjIxIDE2IDEwUzE0LjIxIDYgMTIgNloiIGZpbGw9IiMwMDAwMDAiLz4KPC9zdmc+' }; } /** * Validate that the factory can create adapters */ async validate() { const errors = []; const warnings = []; // Mock adapter has no real requirements, but we can simulate some checks try { // Check if Node.js is available (always true in our environment) if (!process.version) { errors.push('Node.js runtime not detected'); } // Simulate a warning for demonstration if (this.config.errorProbability && this.config.errorProbability > 0.5) { warnings.push(`High error probability configured: ${this.config.errorProbability * 100}%`); } // Check for conflicting configuration if (this.config.defaultDelay && this.config.defaultDelay > 1000) { warnings.push(`High default delay configured: ${this.config.defaultDelay}ms may slow down tests`); } } catch (error) { errors.push(`Validation error: ${error instanceof Error ? error.message : String(error)}`); } return { valid: errors.length === 0, errors, warnings, details: { nodeVersion: process.version, platform: process.platform, config: this.config } }; } } /** * Create a default mock adapter factory */ export function createMockAdapterFactory(config) { return new MockAdapterFactory(config); } //# sourceMappingURL=mock-adapter-factory.js.map