openapi.yaml•10.2 kB
openapi: 3.0.3
info:
title: Python Debugging MCP Tool API
version: 0.1.0
description: |
MCP tool for debugging Python code through breakpoint inspection.
Allows LLMs to set breakpoints, run code, and inspect local variables.
paths:
/sessions:
post:
summary: Start a new debug session
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
entry:
type: string
description: Project-relative script path
args:
type: array
items:
type: string
description: Command-line arguments for the script
env:
type: object
additionalProperties:
type: string
description: Environment variables
pythonPath:
type: string
description: Optional absolute path to Python interpreter
required: [entry]
examples:
basic:
value:
entry: "src/main.py"
with_args:
value:
entry: "tests/test_script.py"
args: ["--verbose", "--debug"]
env:
DEBUG_MODE: "true"
responses:
'200':
description: Session created
content:
application/json:
schema:
type: object
properties:
sessionId:
type: string
examples:
success:
value:
sessionId: "session-abc123-def456"
/sessions/{sessionId}/breakpoint:
post:
summary: Run to a breakpoint
parameters:
- in: path
name: sessionId
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
file:
type: string
description: Project-relative file path
line:
type: integer
minimum: 1
description: 1-based line number
required: [file, line]
examples:
simple:
value:
file: "src/calculator.py"
line: 15
responses:
'200':
description: Breakpoint result
content:
application/json:
schema:
type: object
properties:
hit:
type: boolean
description: Whether breakpoint was hit
frameInfo:
type: object
properties:
file:
type: string
line:
type: integer
nullable: true
locals:
type: object
description: Local variables captured at breakpoint
nullable: true
completed:
type: boolean
description: Whether execution completed without hitting breakpoint
error:
type: object
properties:
type:
type: string
description: Error type (e.g., ValueError, TimeoutError)
message:
type: string
traceback:
type: string
nullable: true
nullable: true
examples:
hit_with_locals:
value:
hit: true
frameInfo:
file: "/workspace/src/calculator.py"
line: 15
locals:
x:
type: "int"
repr: "10"
isTruncated: false
y:
type: "int"
repr: "20"
isTruncated: false
result:
type: "int"
repr: "30"
isTruncated: false
completed: false
error: null
not_hit_completed:
value:
hit: false
frameInfo: null
locals: null
completed: true
error: null
error_before_breakpoint:
value:
hit: false
frameInfo: null
locals: null
completed: false
error:
type: "ZeroDivisionError"
message: "division by zero"
traceback: "Traceback (most recent call last):\n File \"/workspace/src/calculator.py\", line 10, in divide\n return a / b\nZeroDivisionError: division by zero"
/sessions/{sessionId}/continue:
post:
summary: Continue execution to next breakpoint
description: Continue execution within the same session to reach the next breakpoint
parameters:
- in: path
name: sessionId
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
file:
type: string
line:
type: integer
minimum: 1
required: [file, line]
examples:
next_breakpoint:
value:
file: "src/calculator.py"
line: 25
responses:
'200':
description: Continue result
content:
application/json:
schema:
type: object
properties:
hit:
type: boolean
completed:
type: boolean
frameInfo:
type: object
properties:
file:
type: string
line:
type: integer
nullable: true
locals:
type: object
nullable: true
error:
type: object
properties:
type:
type: string
message:
type: string
traceback:
type: string
nullable: true
nullable: true
examples:
hit_second_breakpoint:
value:
hit: true
completed: false
frameInfo:
file: "/workspace/src/calculator.py"
line: 25
locals:
final_result:
type: "float"
repr: "42.5"
isTruncated: false
error: null
execution_completed:
value:
hit: false
completed: true
frameInfo: null
locals: null
error: null
/sessions/{sessionId}:
get:
summary: Get session state
parameters:
- in: path
name: sessionId
required: true
schema:
type: string
responses:
'200':
description: Current state
content:
application/json:
schema:
type: object
properties:
status:
type: string
enum: [idle, running, paused, completed, error]
lastBreakpoint:
type: object
properties:
file:
type: string
line:
type: integer
hitCount:
type: integer
nullable: true
timings:
type: object
properties:
lastRunMs:
type: number
nullable: true
totalCpuTimeMs:
type: number
nullable: true
examples:
paused_at_breakpoint:
value:
status: "paused"
lastBreakpoint:
file: "src/calculator.py"
line: 15
hitCount: 1
timings:
lastRunMs: 125.5
totalCpuTimeMs: 125.5
idle_state:
value:
status: "idle"
lastBreakpoint: null
timings: null
delete:
summary: End session
parameters:
- in: path
name: sessionId
required: true
schema:
type: string
responses:
'200':
description: Ended
content:
application/json:
schema:
type: object
properties:
ended:
type: boolean
examples:
success:
value:
ended: true