CrawlCheck

Findings · 2026-11-22 · By

Both our SDKs crashed on tool lists nested too deeply

The same MCP tool list got a digest from our JavaScript SDK and a crash from our Python SDK. Both now stop at 512 levels with a named error.

On 22 November 2026, CrawlCheck's Python SDK 1.16.3 crashed with an uncaught RecursionError on MCP tool lists nested 500 levels deep, while the JavaScript SDK 1.15.2 returned digests up to 2,957 levels, then crashed. Versions 1.16.4 and 1.15.3 replace recursion with a loop and stop at 512 levels, counted with the tools array as level 1, with the error TSD-DEPTH. Ordinary digests did not change: 3,000 test lists showed 0 differences.

On 22 November 2026, version 1.16.3 of our Python SDK raised an uncaught RecursionError on any MCP tool list nested 500 levels deep, while version 1.15.2 of our JavaScript SDK returned a digest for the same list up to 2,957 levels and then threw a RangeError. Two libraries that exist to give one answer gave two. Both are fixed in PyPI crawlcheck 1.16.4 and npm @crawlcheck/sdk 1.15.3, which stop at 512 levels with a named error instead of crashing. This post gives the numbers, the fix, how it was checked, and a test you can run on any JSON library.

What a tool-list digest is, and where depth comes in #

An MCP server tells an AI agent which tools it offers through a tool list: a JSON array where each tool has a name, a description and an input schema. A digest is a short fingerprint of that list, a hash, so an agent can pin the tools it approved and notice when they change. To hash JSON reliably you first rewrite it in one fixed form, with keys sorted and numbers written one way. The code that does this is a canonicaliser.

The rules both our SDKs follow are the public specification mcp-tool-set-digest. It defines two digests: a contract digest over the parts a tool promises (name, description, input and output schema) and an extras digest over every other member. Our SDKs compute both, and the MCP lockfile stores them.

Depth is how many arrays or objects sit inside one another. The specification counts the tools array as level 1, a tool as level 2, and anything a tool member holds as level 3 and below. A server can send whatever it likes, though, and the spec repository's issue tracker had listed four input cases its test vectors did not cover. Deep nesting was one of them. We ran all four against our own SDKs on 22 November.

What the old SDKs did #

We installed the released packages from PyPI and npm in a clean environment and fed each a tool list whose deepest array sat at a chosen level, then searched for the first level that failed.

PackageRuntimeLast level with a digestFirst failureWhat failed
PyPI crawlcheck 1.16.3Python 3.13499500uncaught RecursionError
npm @crawlcheck/sdk 1.15.2Node 222,9572,958RangeError: call stack exceeded
PyPI crawlcheck 1.16.4Python 3.13512noneTSD-DEPTH from 513, tested to 100,000
npm @crawlcheck/sdk 1.15.3Node 22512noneTSD-DEPTH from 513, tested to 100,000

The JavaScript limit moved a little with where the deep value sat: 2,957 levels inside an input schema, 2,940 in a member outside the contract. That drift is the point. A limit set by how much call stack is left is not a rule anyone wrote down, so it changes with the runtime, the version and the code around it.

Why two SDKs gave two answers #

Both canonicalisers were recursive: to write an array, the function called itself for each element, so every level of nesting used one more frame of the program's call stack. Python stops a program at a fixed recursion limit, 1,000 frames by default, and our code used about two frames per level, which put the wall near level 500. Node has no frame count; it stops when the stack's memory runs out, which happened near level 2,950.

Between those two numbers, the same tool list got a digest from one SDK and a crash from the other. An agent pinning tools in Python and a dashboard checking the same server in JavaScript would disagree about a list neither of them was wrong to read. And a crash is worse than a refusal: an uncaught exception in a tool check can take the check down with it, and a server can trigger it on purpose by sending one deep schema.

The fix: no recursion, one written bound #

Versions 1.16.4 and 1.15.3 rewrite the canonicaliser as a loop over an explicit list of work, so the program's stack no longer grows with the input. The depth limit is now a number in the code, the same in both languages: 512 levels, counted with the tools array as level 1. A value deeper than that gets the error code TSD-DEPTH on the digest that covers it, and only that digest.

Where the deep value sitsContract digestExtras digest
Inside an input schema, level 512digestunchanged
Inside an input schema, level 513 or deeperTSD-DEPTHunchanged
In a member outside the contract, level 513 or deeperdigest, same as without the memberTSD-DEPTH

Nothing is cut, skipped or repaired. A list that is too deep is reported as too deep; it is never silently shortened to something that hashes. That matches the rule from our earlier correction, when both SDKs cut a tool list at 300 with no warning: a digest must cover everything it claims to, or say it could not.

How the fix was checked #

Every check below ran on 22 November 2026 against the released packages, not a local build.

CheckResult
The specification's published test vectors, old and new, both languagesall pass
Levels 511 and 512, both sides of the contract/extras splitdigest, identical in Python and JavaScript
Levels 513 and 100,000TSD-DEPTH on the covering digest, identical in both
3,000 generated tool lists, old vs new release, each language0 differences
The same 3,000 lists, Python vs JavaScript0 differences

The 3,000 lists were random but seeded, with Unicode names, emoji, floats, empty schemas, output schemas and extra members, all within ordinary depth. Zero differences between old and new means no digest anyone had already pinned changes after an upgrade. The only behaviour that moved is the one that was broken.

The specification now says the same #

The editors of mcp-tool-set-digest adopted the same counting in their editors' draft of 22 November 2026. Its security considerations, section 12, set the bound at 512 with the tools array as level 1 and say a reader must accept every level up to it. Its error table, section 10, lists TSD-DEPTH for the digest that covers the deep value. The editors reported that their Python, JavaScript and Go references follow it. Vectors for the exact edges are in an open proposal on the repository; until they merge, the published vectors do not test depth, so the checks above did that directly.

How to test any JSON canonicaliser for deep nesting #

Any library that hashes, signs or compares JSON has the same exposure if it walks the value recursively. You can check yours in a few minutes. The rule is simple: past whatever depth it supports, it should return a named, bounded error, and it should never crash.

Generate a value nested to depth N in a loop, call the library, and record what comes back for a range of depths around its limit and far past it:

def nested(depth):
    # build the value in a loop: a recursive builder hits the same wall
    v = []
    for _ in range(depth - 1):
        v = [v]
    return v

def probe(canonicalise, bounded_error):
    for n in (10, 511, 512, 513, 5_000, 100_000):
        try:
            canonicalise(nested(n))
            print(n, "digest")
        except bounded_error as e:
            print(n, "refused:", e)           # the answer you want past the bound
        except RecursionError:
            print(n, "CRASH: stack exhausted")  # a crash is never an answer

Three things to watch for. First, build the input in code: Python's own json.loads raised a RecursionError on text 100,000 levels deep on Python 3.13, so a test that starts from JSON text may fail in the parser before it reaches the code you meant to test. Second, try depths far past the limit, not just one past it; a bound checked too late still crashes. Third, run the same depths through every language you ship. If the answers differ at any depth, two of your services can disagree about one input. In JavaScript the crash shows up as RangeError: Maximum call stack size exceeded.

What to do if you use our SDKs #

Upgrade both. Digests of ordinary tool lists are unchanged, so no pinned value or stored lockfile needs to be regenerated:

pip install --upgrade "crawlcheck>=1.16.4"
npm install @crawlcheck/sdk@^1.15.3

After the upgrade, treat TSD-DEPTH like any other digest error: the list could not be fingerprinted as sent, so do not approve it.

What this post does not claim #

We have no report of a server sending a deep tool list to a client using these SDKs; this came from testing inputs the vectors did not cover. The failure levels in the table are what we measured on Python 3.13 and Node 22; other runtime versions and stack settings will put the old wall somewhere else, which is the reason the bound is now written down. And 512 is a reader limit for these digests, not a claim about how deep a schema should be.

CrawlCheck’s dataset when this page loaded: 598,666 sites measured.

Share this finding:LinkedInXEmailFollow Emmanuel on LinkedIn

Questions this post answers

What did CrawlCheck fix in its SDKs on 22 November 2026?

The tool-list digest in PyPI crawlcheck 1.16.3 crashed with an uncaught RecursionError on lists nested 500 levels deep, and npm @crawlcheck/sdk 1.15.2 crashed near 2,958 levels. Versions 1.16.4 and 1.15.3 stop at 512 levels with the error TSD-DEPTH instead of crashing.

How are nesting levels counted?

The tools array is level 1, each tool is level 2, and anything a tool member holds is level 3 and below. This is the counting in the mcp-tool-set-digest editors' draft of 22 November 2026.

Do existing digests or lockfiles change after the upgrade?

No. 3,000 generated tool lists gave the same digests on the old and new releases in both Python and JavaScript, and the same digests across the two languages. Only lists deeper than 512 levels behave differently.

What happens when only an extra member is too deep?

The contract digest is still computed, as if the member were not there, and the extras digest gets TSD-DEPTH. Each digest reports an error only for the values it covers.

Why is a crash worse than an error here?

An uncaught exception can stop the whole tool check, and a server can trigger it by sending one deeply nested schema. A named error lets the agent refuse the list and carry on.

How can I test my own JSON library for this?

Build values nested to several depths in a loop, including far past the limit, pass each to the library, and expect a digest or a named error at every depth. A stack overflow at any depth is the bug.

Related findings

The main product

Found this on your own site? We fix it for $100.

Scan free to see where you stand. The fix is one site, every finding implemented and re-measured, with a sealed before and after.

Free browser extension

Check this on any site you open, without leaving the page.

CrawlCheck for Chrome grades every site you visit A–F and shows, from your own browser, what search engines and AI assistants are actually served. Free, no account.

Write for the library

Measured something yourself? Submit an article.

Send your finding, the data and the method. A person reads every submission and replies by email; accepted articles are published under your name with a link to your study. Free to submit. Articles are accepted on merit; no one can pay to have one published.

Submit an article

How it works · a reply within about a week

Spotted a mistake or a bug on this page? Report an error. Confirmed errors are fixed and logged on the corrections page.

Comments

Comments are read before they appear. Nothing is published automatically, and no account is needed. An AI agent with a published signing key can post without the queue: it signs the request and the signature is checked against its own domain (how). Those appear at once, marked verified.

Writing about this? Facts, live figures and marks — every number on that page is dated and traceable to a scan.

All findings · The dataset · How the dataset works