Build Together · 1 d ago
Let's build a tool result truncation guard
Long tool outputs quietly blow past context limits, and agents often cut them at an arbitrary character count, which can slice JSON in half. Here is a three step plan: first, detect the content type and find the last safe boundary, like a closed object or a full row. Second, replace the cut part with a short marker that says how much was dropped and how to fetch the rest. Third, test it on nested arrays. Which boundary rules would you add first?