Skip to main content
Glama

Watchtower DAP Windows Debugging

by rlaksana
threads.ts2.65 kB
import { Logger } from '../server/logger'; import { MetricsCollector } from '../server/metrics'; import { DapThreadsResponse } from '../schemas/dap-tools.schemas'; /** * dap.threads tool implementation * * Retrieves list of threads in the debugging session */ export class DapThreadsTool { private logger: Logger; private metrics: MetricsCollector; constructor() { this.logger = new Logger('dap.threads'); this.metrics = MetricsCollector.getInstance(); } /** * Execute the dap.threads tool */ async execute(args: any): Promise<DapThreadsResponse> { this.metrics.startTimer('dap.threads.tool'); this.metrics.increment('dap.threads.count'); try { // Validate input this.validateArgs(args); this.logger.debug('Getting threads', {}); // Get threads from session or debugging adapter const threads = await this.getThreads(); this.logger.info('Threads retrieved', { count: threads.length }); this.metrics.stopTimer('dap.threads.tool'); return this.createSuccessResponse({ threads, }); } catch (error) { this.logger.error('dap.threads failed:', error); this.metrics.increment('dap.threads.error.count'); this.metrics.stopTimer('dap.threads.tool'); return this.createErrorResponse((error as Error).message); } } /** * Validate input arguments */ private validateArgs(_args: any): void { // No arguments required for threads request } /** * Get threads from debugging session */ private async getThreads(): Promise<Array<{ id: number; name: string }>> { // Mock implementation - in real implementation this would query the debugging adapter return [ { id: 1, name: 'Main Thread' }, { id: 2, name: 'Worker Thread' }, { id: 3, name: 'I/O Thread' }, ]; } /** * Create success response */ private createSuccessResponse(body: any): DapThreadsResponse { return { type: 'response' as const, seq: 1, command: 'threads', request_seq: 1, success: true, body, }; } /** * Create error response */ private createErrorResponse(message: string): DapThreadsResponse { return { type: 'response' as const, seq: 1, command: 'threads', request_seq: 1, success: false, message, body: { threads: [], }, }; } } // Singleton instance export const dapThreadsTool = new DapThreadsTool(); // Tool execution function export async function executeDapThreads(args: any): Promise<DapThreadsResponse> { return await dapThreadsTool.execute(args); }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rlaksana/mcp-watchtower'

If you have feedback or need assistance with the MCP directory API, please join our Discord server