"""Debug mcp.json by counting braces""" import sys with open('C:/Users/Evandro/.pi/agent/mcp.json', 'rb') as f: raw = f.read().decode('utf-8') # Count braces not in strings depth = 0 in_string = False escape = False for i, c in enumerate(raw): if escape: escape = False continue if c == '\\': escape = True continue if c == '"': in_string = not in_string continue if in_string: continue if c == '{': depth += 1 elif c == '}': depth -= 1 print(f'Final depth: {depth}') # Find chrome-devtools and check if its block is properly closed idx_cd = raw.find('"chrome-devtools"') print(f'chrome-devtools at: {idx_cd}') # Show the block from chrome-devtools end = raw.find('"id": "speaches"', 0) if end == -1: end = len(raw) # Find where the whisper block ENDS idx_w = raw.find('"whisper"') print(f'whisper at: {idx_w}') # Show lines around line 140 lines = raw.split('\n') for i in range(max(0, 135), min(len(lines), len(lines))): print(f'{i+1}: {lines[i]}')