Tool Result Trimming — Keeping the Context Window Efficient
Core 6 min +25 XP
💡
THE ANALOGY
A research assistant who summarizes sources rather than handing you entire documents. The full document exists in the library if you need it — but the summary is what gets passed around during analysis. Tool result trimming is this summarization at the architecture level.
⚠️ EXAM TRAP — The Wrong Answer People Choose
Thinking that more context always produces better Claude responses. At some threshold, additional context dilutes attention on what matters. Trim tool results to the relevant portion for the current task.
KEY POINTS
1 Large tool results consume context window space needed for reasoning — trim to the relevant portion.
2 For large datasets, return a summary plus the N most relevant items, not all items.
3 Store full data externally and provide a reference key — Claude can request full details if needed.
4 Trimming is task-specific — what's relevant depends on why the tool was called, not just what data exists.
5 Include item counts so Claude knows total vs shown: 'Showing 5 of 200 orders.'