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

Function stabilizeStructuredContent

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

Source from the content-addressed store, hash-verified

251}
252
253export function stabilizeStructuredContent(content: unknown): unknown {
254 if (typeof content === 'string') {
255 return stabilizeResponseOutput(content);
256 }
257 if (Array.isArray(content)) {
258 return content.map(item => stabilizeStructuredContent(item));
259 }
260 if (typeof content === 'object' && content !== null) {
261 const result: Record<string, unknown> = {};
262 for (const [key, value] of Object.entries(content)) {
263 if (key === 'snapshotFilePath' && typeof value === 'string') {
264 result[key] = '<file>';
265 } else {
266 result[key] = stabilizeStructuredContent(value);
267 }
268 }
269 return result;
270 }
271 return content;
272}
273
274export function stabilizeResponseOutput(text: unknown) {
275 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…