Skip to main content
Glama

Watchtower DAP Windows Debugging

by rlaksana
stepping.ts6.95 kB
import { z } from 'zod'; import { Logger } from '../server/logger'; import { MetricsCollector } from '../server/metrics'; import { DapStepInRequest, DapStepOverRequest, DapStepOutRequest, DapStepInResponse, DapStepOverResponse, DapStepOutResponse, } from '../schemas/dap-tools.schemas'; /** * dap.stepIn, dap.stepOver, dap.stepOut tool implementations * * Handles stepping operations during debugging sessions */ export class DapSteppingTool { private logger: Logger; private metrics: MetricsCollector; constructor() { this.logger = new Logger('dap.stepping'); this.metrics = MetricsCollector.getInstance(); } /** * Execute dap.stepIn tool */ async stepIn(args: any): Promise<DapStepInResponse> { this.metrics.startTimer('dap.stepIn.tool'); this.metrics.increment('dap.stepIn.count'); try { const validatedArgs = this.validateStepInArgs(args); this.logger.debug('Stepping in', { threadId: validatedArgs.threadId }); // Implement stepIn logic await this.executeStepIn(validatedArgs); this.logger.info('Step in completed', { threadId: validatedArgs.threadId }); this.metrics.stopTimer('dap.stepIn.tool'); return this.createStepInSuccessResponse({ threadId: validatedArgs.threadId, }); } catch (error) { this.logger.error('dap.stepIn failed:', error); this.metrics.increment('dap.stepIn.error.count'); this.metrics.stopTimer('dap.stepIn.tool'); return this.createStepInErrorResponse((error as Error).message); } } /** * Execute dap.stepOver tool */ async stepOver(args: any): Promise<DapStepOverResponse> { this.metrics.startTimer('dap.stepOver.tool'); this.metrics.increment('dap.stepOver.count'); try { const validatedArgs = this.validateStepOverArgs(args); this.logger.debug('Stepping over', { threadId: validatedArgs.threadId }); // Implement stepOver logic await this.executeStepOver(validatedArgs); this.logger.info('Step over completed', { threadId: validatedArgs.threadId }); this.metrics.stopTimer('dap.stepOver.tool'); return this.createStepOverSuccessResponse({ threadId: validatedArgs.threadId, }); } catch (error) { this.logger.error('dap.stepOver failed:', error); this.metrics.increment('dap.stepOver.error.count'); this.metrics.stopTimer('dap.stepOver.tool'); return this.createStepOverErrorResponse((error as Error).message); } } /** * Execute dap.stepOut tool */ async stepOut(args: any): Promise<DapStepOutResponse> { this.metrics.startTimer('dap.stepOut.tool'); this.metrics.increment('dap.stepOut.count'); try { const validatedArgs = this.validateStepOutArgs(args); this.logger.debug('Stepping out', { threadId: validatedArgs.threadId }); // Implement stepOut logic await this.executeStepOut(validatedArgs); this.logger.info('Step out completed', { threadId: validatedArgs.threadId }); this.metrics.stopTimer('dap.stepOut.tool'); return this.createStepOutSuccessResponse({ threadId: validatedArgs.threadId, }); } catch (error) { this.logger.error('dap.stepOut failed:', error); this.metrics.increment('dap.stepOut.error.count'); this.metrics.stopTimer('dap.stepOut.tool'); return this.createStepOutErrorResponse((error as Error).message); } } /** * Validate stepIn arguments */ private validateStepInArgs(args: any): DapStepInRequest['arguments'] { const schema = z.object({ threadId: z.number(), targetId: z.string().optional(), waitForAdditionalInformation: z.boolean().default(false), }); const parsed = schema.parse(args); return { ...parsed, __type__: 'StepInArguments' as const, }; } /** * Validate stepOver arguments */ private validateStepOverArgs(args: any): DapStepOverRequest['arguments'] { const schema = z.object({ threadId: z.number(), waitForAdditionalInformation: z.boolean().default(false), }); const parsed = schema.parse(args); return { ...parsed, __type__: 'StepOverArguments' as const, }; } /** * Validate stepOut arguments */ private validateStepOutArgs(args: any): DapStepOutRequest['arguments'] { const schema = z.object({ threadId: z.number(), waitForAdditionalInformation: z.boolean().default(false), }); const parsed = schema.parse(args); return { ...parsed, __type__: 'StepOutArguments' as const, }; } /** * Execute stepIn operation */ private async executeStepIn(args: DapStepInRequest['arguments']): Promise<void> { // Implementation would go here this.logger.debug('Executing stepIn', args); } /** * Execute stepOver operation */ private async executeStepOver(args: DapStepOverRequest['arguments']): Promise<void> { // Implementation would go here this.logger.debug('Executing stepOver', args); } /** * Execute stepOut operation */ private async executeStepOut(args: DapStepOutRequest['arguments']): Promise<void> { // Implementation would go here this.logger.debug('Executing stepOut', args); } /** * Create stepIn success response */ private createStepInSuccessResponse(body: any) { return { type: 'response' as const, seq: 1, command: 'stepIn' as const, request_seq: 1, success: true, body, }; } /** * Create stepOver success response */ private createStepOverSuccessResponse(body: any) { return { type: 'response' as const, seq: 1, command: 'stepOver' as const, request_seq: 1, success: true, body, }; } /** * Create stepOut success response */ private createStepOutSuccessResponse(body: any) { return { type: 'response' as const, seq: 1, command: 'stepOut' as const, request_seq: 1, success: true, body, }; } /** * Create stepIn error response */ private createStepInErrorResponse(message: string) { return { type: 'response' as const, seq: 1, command: 'stepIn' as const, request_seq: 1, success: false, message, }; } /** * Create stepOver error response */ private createStepOverErrorResponse(message: string) { return { type: 'response' as const, seq: 1, command: 'stepOver' as const, request_seq: 1, success: false, message, }; } /** * Create stepOut error response */ private createStepOutErrorResponse(message: string) { return { type: 'response' as const, seq: 1, command: 'stepOut' as const, request_seq: 1, success: false, message, }; } } // Singleton instance export const dapSteppingTool = new DapSteppingTool();

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