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

Function dumpLocalScope

tests/node-debug.test.ts:42–67  ·  view source on GitHub ↗
(Runtime: Client['Runtime'], callFrame: any, { only }: { only?: string[] } = {})

Source from the content-addressed store, hash-verified

40}
41
42async function dumpLocalScope(Runtime: Client['Runtime'], callFrame: any, { only }: { only?: string[] } = {}) {
43 try {
44 const localScope = (callFrame.scopeChain || []).find((s: any) => s.type === 'local');
45 if (!localScope || !localScope.object || !localScope.object.objectId) {
46 debugLog('locals: <no local scope object>');
47 return;
48 }
49 const { result } = await Runtime.getProperties({
50 objectId: localScope.object.objectId,
51 ownProperties: true,
52 accessorPropertiesOnly: false,
53 generatePreview: true
54 });
55 const props = (result || [])
56 .filter((p: any) => p && p.enumerable && p.name !== 'arguments')
57 .filter((p: any) => !only || only.includes(p.name))
58 .map((p: any) => {
59 const v: any = p.value || {};
60 const val = Object.prototype.hasOwnProperty.call(v, 'value') ? v.value : (v.description || v.type);
61 return `${p.name}=${JSON.stringify(val)}`;
62 });
63 debugLog('locals:', props.join(', '));
64 } catch (e: any) {
65 debugLog('locals: <error reading locals>', e && e.message ? e.message : e);
66 }
67}
68
69// MCP-style logging helpers (simulated)
70function mcpLogCall(tool: string, params: unknown) {

Callers 1

node-debug.test.tsFile · 0.85

Calls 1

debugLogFunction · 0.85

Tested by

no test coverage detected