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

Function stabilizeStructuredContent

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

Source from the content-addressed store, hash-verified

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