attach_debugger
Troubleshoot ABAP code by attaching the debugger to a running session. Configure debug mode and optionally target a specific SAP system ID.
Instructions
Attach the debugger to a running ABAP session
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| debug_mode | No | Debugging mode (default: user) | |
| system_id | No | SAP system ID (e.g. DEV). Omit to use default system. |
Implementation Reference
- src/adt-client.ts:510-521 (handler)The actual debugger attach logic: makes an HTTP POST to /sap/bc/adt/debugger?method=attach&debuggingMode=... with stateful headers. This is the core implementation that attaches the debugger to a running ABAP session.
async debuggerAttach(debugMode = "user"): Promise<string> { this.ensureDebugSession(); const resp = await this.http.post( `/sap/bc/adt/debugger?method=attach&debuggingMode=${encodeURIComponent(debugMode)}&requestUser=${encodeURIComponent(this.config.username.toUpperCase())}`, "", { headers: this.statefulHeaders({ Accept: "application/xml" }), responseType: "text", } ); return resp.data as string; } - src/mcp-server.ts:714-724 (registration)Tool registration in the ListToolsRequestSchema handler: defines the tool name, description, and input schema for the MCP tool listing.
name: "attach_debugger", description: "Attach the debugger to a running ABAP session", inputSchema: { type: "object" as const, properties: { debug_mode: { type: "string", description: "Debugging mode (default: user)" }, ...SYSTEM_ID_PROP, }, required: [], }, }, - src/mcp-server.ts:1227-1231 (handler)The CallToolRequestSchema handler for attach_debugger: parses the debug_mode argument from the request and delegates to client.debuggerAttach().
case "attach_debugger": { const debugMode = (args as Record<string, unknown>)?.debug_mode as string | undefined; const result = await client.debuggerAttach(debugMode); return { content: [{ type: "text", text: result }] }; } - src/mcp-server.ts:130-134 (schema)The attach_debugger tool does not have a dedicated Zod schema; it directly accesses args.debug_mode as a string. The related DebuggerListenSchema (used by start/stop/get_session) is shown for context.
const DebuggerListenSchema = z.object({ terminal_id: z.string().optional(), ide_id: z.string().optional(), user: z.string().optional(), }); - src/adt-client.ts:434-438 (helper)Helper guard that ensures a debug session is active before allowing debugger operations like attach. Throws an error if no session exists.
private ensureDebugSession(): void { if (!this.debugSessionActive) { throw new Error("No active debug session. Call start_debugger_listener first."); } }