[FEATURE]: Context protection for tool calls when response is large #3007

Closed
opened 2026-02-16 17:38:14 -05:00 by yindo · 1 comment
Owner

Originally created by @conradkoh on GitHub (Nov 20, 2025).

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

The problem is that when executing a tool, it is often unknown whether the agent will be able to handle the output of the tool within its context window. Here are examples:

  1. Running a test suite with 1000s of tests and many debug error messages
  2. Using an MCP which reads web pages

I’ve seen in cursor that it is able to use grep and other tools against a file of sorts to deconstruct and study the output without going off track when a tool responds with large context.

Perhaps we can have detection of such a case and automatically add to the context: “tool output of {x} lines was written to {file}.txt” and allow the agent to decide what it wants to do with that.

Originally created by @conradkoh on GitHub (Nov 20, 2025). ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request The problem is that when executing a tool, it is often unknown whether the agent will be able to handle the output of the tool within its context window. Here are examples: 1. Running a test suite with 1000s of tests and many debug error messages 2. Using an MCP which reads web pages I’ve seen in cursor that it is able to use grep and other tools against a file of sorts to deconstruct and study the output without going off track when a tool responds with large context. Perhaps we can have detection of such a case and automatically add to the context: “tool output of {x} lines was written to {file}.txt” and allow the agent to decide what it wants to do with that.
yindo added the discussion label 2026-02-16 17:38:14 -05:00
yindo closed this issue 2026-02-16 17:38:14 -05:00
Author
Owner

@rekram1-node commented on GitHub (Nov 21, 2025):

related but if a tool blows up the context we should be able to "self heal" it shouldnt make the session crap out we should be able to handle the error case and fix it

@rekram1-node commented on GitHub (Nov 21, 2025): related but if a tool blows up the context we should be able to "self heal" it shouldnt make the session crap out we should be able to handle the error case and fix it
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3007