MCPcopy Create free account
hub / github.com/ScriptedAlchemy/devtools-debugger-mcp / collectScopes

Function collectScopes

tests/node-debug-advanced.test.ts:58–82  ·  view source on GitHub ↗
(Runtime: Client['Runtime'], frame: any, parsedScripts: any[])

Source from the content-addressed store, hash-verified

56}
57
58async function collectScopes(Runtime: Client['Runtime'], frame: any, parsedScripts: any[]) {
59 const scopes: any[] = [];
60 for (const s of frame.scopeChain || []) {
61 const type = s.type;
62 if (!s.object || !s.object.objectId) continue;
63 const variables = await getProps(Runtime, s.object.objectId, type === 'global' ? 5 : 20);
64 scopes.push({ type, variables, truncated: type === 'global' });
65 }
66 let thisSummary: any = null;
67 if (frame.this) {
68 const t = frame.this;
69 thisSummary = { type: t.type, description: t.description, className: t.className };
70 if (t.objectId) thisSummary.preview = await getProps(Runtime, t.objectId, 8);
71 }
72 return {
73 frame: {
74 functionName: frame.functionName || null,
75 url: frameUrl(frame, parsedScripts),
76 line: frame.location.lineNumber + 1,
77 column: (frame.location.columnNumber ?? 0) + 1
78 },
79 this: thisSummary,
80 scopes
81 };
82}
83
84test('advanced: scopes, this, arguments, and call stack across steps', { timeout: 30000 }, async () => {
85 const { proc, port } = await startDebuggedProcess(scriptPath);

Callers 1

Calls 2

getPropsFunction · 0.85
frameUrlFunction · 0.85

Tested by

no test coverage detected