Feature: Add ability to get loaded scripts

Open
#72 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
72/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
typescript, vscode
Domain
devtools

Research direction

Start at the existing MCP tool entry point for adding get_loaded_scripts, then trace how it accesses vscode.debug.activeDebugSession. Use the loadedSources custom request while a debug session is running, and verify completion by checking the returned sources plus clear errors for no active session or unsupported adapters.

Written by the indexing model from the issue text.

Description

Summary

Add a new MCP tool called get_loaded_scripts that returns all scripts currently loaded in the active debug session.

Problem

When an AI agent wants to set a breakpoint, it currently has no way to know which files are actually loaded by the runtime. This forces the agent to guess file paths, which is a leading cause of breakpoints silently failing to bind (see #18). VS Code's Loaded Scripts explorer (visible in the Run & Debug sidebar) already shows this information — it just isn't surfaced through DebugMCP.

Proposed Solution

Add a get_loaded_scripts tool that uses the Debug Adapter Protocol loadedSources request via vscode.debug.activeDebugSession.customRequest('loadedSources', {}) to return the list of all sources loaded by the runtime.

Requirements:

  • No parameters required
  • Must work on a running debug session — does not require the session to be paused or stopped at a breakpoint
  • Should return a clear error if no debug session is active
  • Should return a graceful error if the debug adapter does not support loadedSources (it is an optional DAP capability — supported by Node.js, Electron, and Chrome-based adapters)
Dominant language
TypeScript
Stars
511
Forks
60
Avg merge
2d 1h
Merged PRs (30d)
18

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/DebugMCP

All issues in microsoft/DebugMCP

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.