MCPcopy Create free account
hub / github.com/ChromeDevTools/chrome-devtools-mcp / stabilizeStructuredContent

Function stabilizeStructuredContent

tests/utils.ts:298–317  ·  view source on GitHub ↗
(content: unknown)

Source from the content-addressed store, hash-verified

296}
297
298export function stabilizeStructuredContent(content: unknown): unknown {
299 if (typeof content === 'string') {
300 return stabilizeResponseOutput(content);
301 }
302 if (Array.isArray(content)) {
303 return content.map(item => stabilizeStructuredContent(item));
304 }
305 if (typeof content === 'object' && content !== null) {
306 const result: Record<string, unknown> = {};
307 for (const [key, value] of Object.entries(content)) {
308 if (key === 'snapshotFilePath' && typeof value === 'string') {
309 result[key] = '<file>';
310 } else {
311 result[key] = stabilizeStructuredContent(value);
312 }
313 }
314 return result;
315 }
316 return content;
317}
318
319export function stabilizeResponseOutput(text: unknown) {
320 if (typeof text !== 'string') {

Callers 3

testIncludesWebmcpToolsFunction · 0.85
console.test.tsFile · 0.85

Calls 1

stabilizeResponseOutputFunction · 0.85

Tested by 1

testIncludesWebmcpToolsFunction · 0.68