Skip to content

keep the write_episode example inside the client's 2048-char window - #38

Merged
ayushcodes10 merged 1 commit into
mainfrom
fix/tool-description-truncation
Sep 3, 2026
Merged

keep the write_episode example inside the client's 2048-char window#38
ayushcodes10 merged 1 commit into
mainfrom
fix/tool-description-truncation

Conversation

@ayushcodes10

Copy link
Copy Markdown
Owner

Surfaced by restarting the eigen session — a debug line in the MCP connection log:

Tool "write_episode" description truncated from 2252 to 2048 chars

What every session has actually been seeing

...entities=[{"name": "Postgres", "type": "tool"}, {"name": "Decisi

Cut mid-word. The entire facts=[...] argument — source, target, relation_type, fact, confidenceis never shown.

The only worked example for write_episode stopped before demonstrating half the call. In the tool whose adoption is the entire problem this project exists to solve. A truncated example is worse than no example, because it still reads as authoritative.

This has been true in every session that ever connected, and the only trace was a debug line nobody reads.

The fix

Docstring is now 1723 chars, 325 under the limit, example intact. Nothing a caller needs was dropped — the surrounding prose was tightened.

Why it is tested, not just fixed

Length is a correctness property here, and crossing the limit is silent. The tests read the descriptions the server actually publishes (_tool_manager.list_tools()), so they measure what a client receives rather than what the source looks like:

  • every tool under 2048
  • 100 chars of headroom, so an ordinary edit fails the build before it fails a client
  • the visible example is balanced — (), [], {} all matched
  • every required argument (scope, session_id, entities, facts) and every fact key visible
  • all three confidence values inside the window, since the server rejects anything else

Each guard was verified to fail against the bug reintroduced — 4 of 5 fail when the docstring is re-bloated — rather than merely passing. That's the practice the eigen session adopted after finding a guard that had only ever passed and asserted nothing.

Testing

411 pass, 5 added.

Claude Code truncates an MCP tool description at 2048 characters and reports it
as a debug line nobody reads. Restarting the eigen session surfaced one:

  Tool "write_episode" description truncated from 2252 to 2048 chars

Every session that has ever connected saw the description cut mid-word:

  ...entities=[{"name": "Postgres", "type": "tool"}, {"name": "Decisi

The whole facts=[...] argument - source, target, relation_type, fact,
confidence - was never shown. The only worked example for the tool stopped
before demonstrating half the call, in the tool whose adoption is the entire
problem this project exists to solve. A cut example is worse than no example,
because it still reads as authoritative.

The docstring is now 1723 characters, 325 under the limit, with the example
whole. Nothing was dropped that a caller needs; the prose around it was
tightened.

Length is a correctness property here, so it is now tested against the
descriptions the server actually publishes rather than the source text: every
tool under the limit, 100 characters of headroom so an ordinary edit fails the
build before it fails a client, the example balanced and complete, every
required argument and all three confidence values inside the window.

Each guard was verified to fail against the bug reintroduced, not merely to
pass - the practice the eigen session adopted after a guard that had only ever
passed turned out to assert nothing.

411 tests pass, 5 added.
@ayushcodes10
ayushcodes10 merged commit 0802c89 into main Sep 3, 2026
2 checks passed
@ayushcodes10
ayushcodes10 deleted the fix/tool-description-truncation branch September 3, 2026 11:00
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant