Conversation
Claude Code cuts MCP tool descriptions at 2048 chars. OpenCode appends the available subagents after ~2300 chars of guidance, so Claude never saw valid subagent_type values. Move the list to the front of long descriptions; the cut then falls on the tail of the guidance.
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.
Claude Code cuts MCP tool descriptions at 2048 characters. OpenCode's
tasktool description is about 2300 characters of guidance, and the "Available agent types…" list comes after it. So the list is always cut off. Onclaude-code/*models, Claude doesn't know whichsubagent_typevalues exist. It guesses, or it avoids custom subagents entirely.This PR adds
fitToolDescription()insrc/tool-description.ts. When a description is over the limit and contains OpenCode's agent-list marker, the list is moved to the front and the full guidance follows it. Nothing is removed on our side; the cut now falls on the end of the generic guidance. Other tools and short descriptions are unchanged.Test:
test/tool-description-regression.tschecks that every agent is inside the first 2048 chars after the reorder (none are before it), that the full guidance and list are both kept, and that short or list-less descriptions pass through unchanged.bun test/smoke.tsandtsc --noEmitpass.For context, we run a condensed version of the guidance locally (about 1850 chars in total) so the most useful rules also fit. I left that out because it hard-codes OpenCode's wording. Happy to add it if you prefer.