On this page
check_and_preview truncates oversized tool output to a head/tail preview; FullRetrievalGuard tracks which paths a session has already previewed, so full=true is only honored after a prior preview was returned.
#tool.src.orxtra.tool._preview
#tool.src.orxtra.tool._preview
#PreviewResult
Result of a preview check on tool output content.
#check_and_preview
def check_and_preview(content: str, threshold: int, preview_lines: int) -> PreviewResultIf content exceeds threshold bytes, return head/tail preview.
Args:
content: The full content to potentially preview.threshold: Byte size threshold. Content at or under this is returned in full.preview_lines: Number of lines to show at head and tail of the preview.
Returns:
- PreviewResult with either full content or a head/tail preview.
#FullRetrievalGuard
Tracks which paths have received previews per session.
full=true on a tool call is only honored if the session already received a preview for that path. This prevents agents from bypassing the preview system by always requesting full content.
#record_preview
def record_preview(self, session_id: str, path: str) -> NoneRecord that a session received a preview for a path.
#check_full_allowed
def check_full_allowed(self, session_id: str, path: str) -> boolCheck if a session is allowed to request full content for a path.
Returns True only if the session previously received a preview.