orxtra v0.13.0 /tool.src.orxtra.tool._preview
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

python
def check_and_preview(content: str, threshold: int, preview_lines: int) -> PreviewResult

If 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

python
def record_preview(self, session_id: str, path: str) -> None

Record that a session received a preview for a path.

#check_full_allowed

python
def check_full_allowed(self, session_id: str, path: str) -> bool

Check if a session is allowed to request full content for a path.

Returns True only if the session previously received a preview.

Search