Direct answer
Large tool results can bury the error that matters. A test log may truncate before the failing assertion, or an MCP result may arrive without enough structure for the agent to know what happened. Send a compact status, failed checks, decisive error and artifact location before optional detail.
Do not assume a universal 10 KiB limit. The supplied official sources establish none. Community: issue #27896 reports a silent failure before tool-call emission and closed as NOT_PLANNED without a fix; issue #26968 asks for verbose MCP output controls and is a feature request, not a confirmed defect.
The practical fix is to preserve the signal at the source. Leave full logs outside the model context, return a structured summary, and verify the underlying artifact before accepting the agent’s conclusion.
Why a long result can produce a short-sighted answer
Tool output is evidence. When the decisive line sits at the end of thousands of routine lines, the agent may receive a truncated view that looks calm. A missing failure can then become a false belief that the command succeeded.
MCP, short for Model Context Protocol, connects an agent to external tools and data. Its results can include command output, records, documents or structured content. Whatever the transport, the agent still needs a result that preserves the decision-relevant facts.
The danger is not only size. A large result can contain the right error but leave its relationship unclear. Stack traces without the failed test name, JSON responses without status, or diffs without the rejected file force the next model turn to reconstruct context.
The proof-of-work packet provides the right standard: changed files, command output and an independently checked result. A tool summary should point to that evidence rather than replace it.
The long-context latency test adds a second reason to compact output. Every verbose result can enlarge the next request, increasing input volume and changing cache treatment. Smaller output is useful only if it keeps the failure visible.
Size is not the only cost. A verbose result can also push a session toward compaction, which replaces older turns with a server-written summary. The compaction cost worksheet models that state transition without inventing a fixed price. If tool noise helps trigger the transition, the team may pay for summarization and still lose exact evidence unless the artifact survives outside the transcript.
Artifact storage is therefore part of output design. Preserve the full log even when the model receives a short result. Otherwise, compression saves context today and removes the proof needed to debug tomorrow.
Where truncation can happen
Use “truncation” carefully. It can mean a client cut a result, a tool chose to return a preview, a model reached an output limit, or a transport delivered only part of a payload. Those events need different evidence.
Official: max_tokens means the output limit was reached, while model_context_window_exceeded means the context filled. tool_use requires a tool result, and pause_turn requires continuing the assistant turn. A stop reason identifies how a response ended; it does not prove which tool bytes were omitted.
Community: issue #27896 reports a silent failure before tool-call emission. The report closed as NOT_PLANNED with no official fix version. Treat it as a reason to capture request and tool events, not as proof that every Claude Code tool call fails silently.
Community: issue #26968 requests more control over verbose MCP output. A feature request shows a user need, not a confirmed truncation defect. Separate those labels when diagnosing a session.
| Boundary | What may be lost | Evidence to capture |
|---|---|---|
| Tool producer | Full log or record set | Producer output and artifact path |
| MCP server | Payload detail or metadata | Server response and declared result size |
| Client display | Visible portion of a result | Client version and display state |
| Model output | Generated text after a stop | Stop reason and output token count |
| Context assembly | Earlier turns or tool results | Compaction events and usage record |
The exact Claude Code path may expose only some of these boundaries. Mark the others Unknown rather than filling the gap with a familiar forum explanation.
The usage tracking and historical cost API guide helps with request-level evidence, but historical cost data is not a byte-level tool log. Use it to understand volume and timing, not to prove where a result was cut.
A truncated success is worse than an obvious error
An explicit failure gives the agent a next action. A truncated log that omits the failure can make the agent continue with the wrong state. It may report success, run another broad search or edit code that already failed verification.
Output format therefore belongs in the tool contract. The tool should not make the model infer success from the absence of an error in a partial result. Provide an explicit status even when detail is unavailable.
The independent research on structured behavioral oracles describes encoding preserved or changed behavior, setup constraints and control-flow hints to guide executable tests. The product guarantee does not follow from that research, but the design lesson applies: evidence should carry meaning, not just volume.
A useful result answers four questions. Did the command run? What was the outcome? Which check decided the outcome? Where can the full evidence be inspected? If one answer is missing, the agent may improvise.
| Question | Compact field | Why it matters |
|---|---|---|
| Did it run? | execution |
Distinguishes skipped from completed |
| What happened? | status |
Prevents silence from implying success |
| What decided it? | decisive_error |
Preserves the actionable signal |
| Where is the proof? | artifact |
Supports independent verification |
The generated-test oracle bias guide adds a related warning. A test can inherit the implementation’s mistake, so a green status is not automatically correct behavior. Define the expected result before using tool output as an oracle.
Design a compact result contract
A compact result should be predictable across commands. Use the same top-level fields so the agent can learn one reading pattern instead of decoding a new format for every tool.
Start with an explicit execution state. Values such as completed, failed, timed out or skipped describe whether the command reached a result. Follow with a status that says whether the acceptance checks passed. Those fields are related but not identical.
Then preserve scope. Name the test file, package, endpoint or records examined. Scope prevents a successful subset from being mistaken for a complete run.
The decisive error belongs near the top. Include the failing test name, error type and a short message. Put the full stack trace or log in an artifact, with a focused excerpt only when it helps the next action.
| Field | Example shape | Rule |
|---|---|---|
execution |
completed |
Never infer this from silence |
status |
failed |
State the acceptance outcome |
scope |
package/tests/example |
Say what was and was not checked |
summary |
one sentence |
Describe the result without hiding failure |
decisive_error |
name, type, message |
Keep the signal before optional detail |
artifact |
path or URI |
Point to full evidence |
truncation |
none, preview, omitted |
Disclose missing detail |
next_action |
focused command |
Suggest a bounded next step |
This is an editorial contract, not an official Claude Code schema. Adapt field names to the tool while preserving the meaning. The important part is that omission is visible.
For retrieval, the monorepo search and token budget guide applies the same principle. Candidate files should be ranked and scoped instead of returned as an unbounded dump.
Put status before detail
Ordering is a control. If the first screen contains progress lines and the failure appears at the end, a preview can hide the most important fact. Place the outcome first, then scope, then the decisive error, then optional context.
A progress stream can still be useful for a human watching a long command. Leave it in the terminal or a log file. The model-facing result should be a final structured summary unless live progress changes the next decision.
Avoid vague success words. “Looks good” does not say which checks ran. “Command exited successfully” says something narrower and more useful. Neither statement proves the feature meets the behavioral requirement.
A failure summary should also avoid blame. Name the failed assertion and observed value. “Validation failed because the response omitted request_id” gives the agent a target. “The API is broken” sends it toward speculation.
When a tool cannot determine the outcome, return unknown with the reason. This is more honest than an empty error field. The agent can then request the missing artifact or stop for human review.
The subagent context and duplicate-work analysis shows why a clear returned report matters. A subagent starts with isolated context and does not automatically see the parent’s full history. Its report must carry the evidence the parent needs.
A test-log pattern that keeps the failure
Imagine a focused test command. The full log may contain setup output, passing cases and one failing assertion. Store the complete log as an artifact, then return a small result for the model.
A safe pattern is to capture the exit code, identify failed test names, extract a bounded excerpt around each failure and include the artifact path. Do not silently discard the excerpt if parsing fails. Send the raw tail with a truncation warning instead.
| Log element | Model-facing treatment | Full-artifact treatment |
|---|---|---|
| Command and exit code | Always include | Preserve exact invocation |
| Failed test names | Include all known failures | Keep complete list |
| First decisive error | Include near the top | Keep full stack and context |
| Passing tests | Count or omit | Keep names and durations |
| Progress noise | Omit | Keep when useful for debugging |
| Truncated section | Mark explicitly | Preserve original bytes if possible |
The table describes a pattern, not a measured Claude Code limit. The tool can choose its own preview size. The requirement is that a preview never disguises itself as the full result.
A verification checklist should ask whether the artifact exists, whether the summary matches it and whether the failed check has an owner. The proof-of-work packet is the place to keep those answers.
If the artifact lives outside the repository, record how an authorized reviewer can retrieve it. Do not put credentials or private production data into the model-facing summary. The agent harness security boundary guide explains why tool output can cross a trust boundary.
Bound detail without losing provenance
A compact summary needs provenance. Include the command, working scope and artifact location so a reviewer can reproduce the result. Compression without provenance makes the output harder to trust, not easier.
When a result is sampled, say so. “First failure excerpt” is different from “all failures.” When records are paginated, state the page and total if known. When a search is capped, report the cap and the query.
These disclosures prevent a subtle failure: the agent treats a selected subset as the complete population. A search that returns ten candidates may have more. A test preview may contain only one of several failures.
| Result mode | Required disclosure |
|---|---|
| Full result | Scope and completion state |
| Preview | Previewed portion and omitted remainder |
| Paginated result | Page, page size and total when known |
| Search cap | Query, cap and whether the cap was reached |
| Parse failure | Raw fallback and parsing warning |
| Timeout | Partial output and incomplete status |
The task budgets versus hard stops guide is relevant to timeouts. A workflow that must stop needs enforceable controls and a clear partial-result state. An advisory budget is not proof that a tool finished.
Official: the Agent SDK documents max_turns and max_budget_usd as loop stops. Tool timeouts are a separate control. A timeout should return enough state for the caller to decide whether a retry is safe.
Verify the artifact, not just the summary
A structured result can still be wrong. The tool may summarize the wrong file, misread an exit code or point to a stale artifact. Verification closes that gap.
Start by checking that the artifact exists and matches the reported scope. Then inspect the decisive lines directly. For a test failure, confirm the test name and assertion. For an API result, confirm the status and response fields that drove the decision.
Next, compare the summary with the artifact. If the summary says one failure and the artifact contains three, the parsing step needs repair. If the summary says completed but the artifact ends mid-command, the execution state is wrong.
Finally, run the acceptance check independently when practical. The generated-test oracle bias guide explains why a test generated from the implementation can inherit its faults. A behavioral requirement should remain visible outside the generated code.
Use truncation metadata as a first-class result
Do not make the agent guess whether output was shortened. Add a truncation field with a small vocabulary: none, preview, omitted or unknown. Explain what was omitted and where the full result lives.
Truncation metadata changes behavior. An agent that sees preview can request the failed section instead of treating the visible tail as complete. An agent that sees unknown can stop and ask for better instrumentation.
A result can be truncated by the producer before the MCP server sees it. In that case, the server should disclose its own limit rather than imply the upstream output was complete. Layering summaries makes each boundary’s responsibility clearer.
The official sources in this packet do not establish one universal limit. Avoid hard-coding a folklore number into prompts or tests. If a tool has a documented cap, record that cap with the tool version and enforce it at the producer.
When a cap is reached, preserve the beginning and the decisive end when the format allows it. A middle omission marker is more honest than an unexplained join. For test logs, a focused failure excerpt is usually more useful than an arbitrary byte slice.
The idle-session cache-miss analysis provides a related measurement habit. Changing an early prefix can affect later cache reuse, so output structure belongs in the request record, not only in the tool’s display settings.
Subagents make result contracts more important
A subagent’s report is a handoff between isolated contexts. If the report says only that tests failed, the parent may repeat the entire investigation. If it names the failing check and artifact, the parent can make a focused decision.
Official: custom subagents start with fresh context that includes the system prompt, task message, CLAUDE.md files, git status and preloaded skills. They do not automatically receive the parent’s full conversation. Returned evidence must therefore be self-contained.
Ask each subagent to return a fixed report: scope examined, files changed, checks run, decisive failures, artifact locations and unresolved questions. This format reduces duplicated discovery without pretending the agents share hidden memory.
| Handoff field | What the parent needs |
|---|---|
| Scope | Boundaries of the investigation |
| Findings | Specific files, symbols or behaviors |
| Changes | Exact modified paths or none |
| Verification | Commands and outcomes |
| Failures | Decisive error and artifact |
| Unknowns | Questions that remain open |
The subagent stop and resume semantics guide prevents another mistake. Stopped subagents do not auto-resume when messaged, while completed subagents can be resumed with history. A missing report may be a lifecycle issue rather than truncated output.
The background running-count diagnosis adds a UI warning. A stale count is not proof that the agent is still producing output. Verify the task state and returned artifact before launching duplicate work.
Keep full evidence outside the prompt
A full log can be valuable without belonging in every model request. Store it in a test artifact, CI result or local file with a stable path. Send the focused summary to the agent and allow a bounded follow-up read.
This separation supports both debugging and cost control. The human can inspect the complete record, while the model receives the signal needed for the next action. The cost per verified change framework keeps the value of that evidence tied to accepted work.
The context-portable migration guide matters when the workflow changes clients. An artifact path and result schema travel more reliably than a client-specific transcript full of pasted logs.
Security still applies. A log can contain tokens, personal data or internal hostnames. Redact the model-facing summary and restrict artifact access. Do not solve truncation by pasting sensitive raw output into a broader prompt.
The Claude Code settings-file secret exposure guide is a related reminder that convenience settings can cross a secret boundary. Tool output deserves the same review.
A verification checklist for the next failure
When a tool result looks incomplete, pause before accepting the agent’s interpretation. Ask whether the command completed, whether the result is full or previewed, and whether the decisive error is visible.
Then locate the artifact. Check its scope and timestamp. A stale log from an earlier run can make a current result look consistent when it is not.
If the artifact is unavailable, mark the outcome unknown. Do not let the agent fill the gap with a confident summary. It can retry a bounded command, request better output or stop for human inspection.
| Check | Pass condition |
|---|---|
| Execution state | Completed, failed, timed out or skipped is explicit |
| Scope | Command and tested area are named |
| Decisive signal | Failure or success evidence appears early |
| Truncation disclosure | Omitted detail is marked |
| Artifact | Full evidence has a retrievable location |
| Summary match | Key facts agree with the artifact |
| Acceptance | Behavioral requirement is checked independently |
The verification proof packet can hold the final evidence. A compact result is an input to verification, not a substitute for it.
If a tool repeatedly hides failures, fix the producer or server contract. Adding a longer prompt asking the model to “look carefully” does not restore bytes that were never delivered.
The honest loss
A compact structured result can preserve the decisive failure while reducing noise and repeated context. This is a concrete win when the artifact remains available and the summary is checked.
The loss is that compression can omit qualifiers, secondary failures or unexpected output. A summary is not the raw record, and a schema can make an incomplete result look authoritative. Preserve provenance and disclose omissions.
The public evidence does not establish a universal Claude Code output cap, a failure rate or an official fix for the reported silent event. Issue #27896 and issue #26968 show reported needs, not population data. Future updates should revisit official documentation and publish repeatable tool fixtures with producer, server and client versions.
Do not claim that every MCP result truncates or that every grep loop is wrong. The defensible response is narrower: design the result so the decisive signal survives, then verify the artifact. A missing detail should remain visibly missing until the evidence is recovered.
Practical response: test the same fixture in an OpenAI-format agent
If you want to compare tool-result handling, use the same fixture, tool schema and acceptance checks. One AI API Key lists 46 live free model IDs for OpenAI-format agents such as OpenCode, Cline or Cursor. The quickstart uses https://api.oneaiapikey.com/v1, and the pricing page explains prepaid billing.
The free IDs do not work inside Claude Code. The documented Claude Code route uses the Anthropic Messages format, but all four Claude IDs were unavailable on 2026-11-27. Run the active test on an OpenAI-format client. The OpenAI versus Anthropic format guide explains why the client boundary matters.
The free lane shares 100 requests and 5,000,000 tokens per day per account, resets at 05:30 IST or 00:00 UTC, and allows one request in flight per key. Use the model catalogue for availability and the cost calculator for estimates.
Create a disposable key with expiry and a narrow allowlist through the API reference, read the privacy and retention policy, and use sign-up. Supply synthetic logs, preserve the full artifact and compare whether each stack keeps the decisive failure visible. Different agents may handle tools differently, so report the whole stack rather than attributing every difference to the model.
FAQ
Does Claude Code have a universal 10 KiB tool-output limit?
The supplied official sources do not establish one. Check the specific tool, server and client documentation, then record the observed boundary.
Is issue #26968 proof that MCP output is broken?
No. It is a feature request about verbose output controls. It shows a user need, not a confirmed universal defect.
What should a tool return before a long log?
Provide explicit execution status, scope, failed checks, the decisive error, truncation metadata and the full-artifact location.
Can a stop reason prove that a tool result was truncated?
No. Stop reasons describe how the model response ended. They do not provide a byte-level account of every tool payload.
How should an agent handle an incomplete result?
Mark the outcome unknown or partial, inspect the artifact, and request a bounded excerpt. Do not treat missing detail as success.
More Claude Code troubleshooting
- Claude Code WSL IDE environment-variable diagnosis
- Claude Code WSL2 memory-warning breakdown
- Claude Code Windows subagent MCP memory leaks
- Claude Code VS Code WebSocket regression test
- Claude Code desktop browser-pane crash recovery
- Claude Code subagent hang and timeout controls
- Claude Code parallel-agent worktree isolation
- Claude Code prompt-caching break-even math
- Claude Code 429 error decision tree
- Claude Code billing-dispute evidence packet
- Claude Code refund and support policy guide
- Claude Code hallucinated-package supply-chain controls
- Claude Code GitHub Actions secret boundaries
- Claude Code repository-hook security review
- Claude Code extension-trojan remediation steps
- Claude Code CVE-2026-55607 sandbox boundary
- Claude Code auto-mode classifier limitations
- Claude Code destructive git guardrails
- Claude Code legacy-code characterization workflow
Sources
- Community report on failure before tool-call emission
- Community feature request for verbose MCP output controls
- Official Claude stop reason reference
- Official custom subagent context and lifecycle
- Official Agent SDK loop stops
- Anthropic large-codebase guidance
- Independent research on structured behavioral oracles