Repository navigation
fix(mcp): passed-on instructions fit the client's 4096 characters - #469
Merged
Merged
Conversation
Claude Code keeps 4096 characters of a server's instructions. devstack mcp now keeps devstack's own text and every upstream's section within that: the upstreams share what is left evenly, and what a short one does not need goes to the longer ones. A shortened section says so; the new tool `instructions` with the upstream's prefix returns the full text. Closes #456 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7schmiede
force-pushed
the
fix/mcp-instructions-budget
branch
from
November 6, 2026 12:47
5db8791 to
9268878
Compare
This was referenced Nov 6, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
devstack mcppassed on its MCP upstreams' instructions ininitializewith no limit on the whole. Claude Code keeps 4096 characters of a server's instructions, so an upstream whose section started past that never reached the agent; a short in-house routine listed after two long public servers was lost (#456).instructionstext (devstack's own, the preface, every upstream's section and the notes) now stays within 4096 characters, counted in UTF-16 units as a JavaScript client counts.…) and ends with one quoted line:[shortened by devstack: the tool \instructions` with prefix `` returns the full text]`.
instructions(prefix, with or without__): an upstream's full text, as the hub has it (GET /hub/upstreams/instructions); an unknown prefix names those that gave instructions.devstackskill anddocs/dashboard-api.mdname the tool; CHANGELOG entry under Fixed.Not addressed here: the issue's side note about an upstream redeployed with new instructions while the hub kept the old text (unverified).
Review card
devstack mcpkeeps its whole instructions under 4096 characters; each upstream gets a fair share (budget/n, an unused share goes to the others), and a shortened section says so in one line.instructionswithprefixreturns an upstream's full text; the shortening line points to it.Approved by the owner on 2026-11-06: points 4 and 5 (together with points 1–3 for #467, built in a separate PR).
Decided on my own: the 300-character minimum share, counting in UTF-16 units, cutting at a line boundary where possible.
Tests
cargo fmt --all -- --check,cargo clippy --workspace --all-targets --locked -- -D warnings: cleancargo test -p devstack -p devstack-skills --locked: green; new unit tests for the budget (three upstreams as in devstack mcp: passed-on upstream instructions exceed Claude Code's 4096 characters, later upstreams are cut off #456: total within 4096, the short one whole, equal shares for the two long ones, independent of order), the share function, left-out naming, and the tool.Closes #456
🤖 Generated with Claude Code