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

Function stabilizeStructuredContent

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

Source from the content-addressed store, hash-verified

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