From 9d555a70b64e33e1b0051cc237043d28f1f12f7c Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Tue, 21 Apr 2026 14:58:55 -0300 Subject: [PATCH] fix: reduce `fetch` and `view` tools truncation size to 100KB Some models like Kimi K2.5 and GLM 5 simply don't handle well that many content. When a big page or JSON API is fetch, it can break Crush sessions. We're drastically reducing the truncation size here, to 1/10 of what we had before. It may look too much at first look, but 100KB it's actually very reasonable. For example, the entire Task guide, which is significantly large, is only 61KB: https://taskfile.dev/docs/guide.md --- internal/agent/tools/fetch.go | 2 +- internal/agent/tools/fetch.md | 4 ++-- internal/agent/tools/view.go | 2 +- internal/agent/tools/view.md | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/agent/tools/fetch.go b/internal/agent/tools/fetch.go index 90db1a179980e8fa3f65491c28123b0b62e797fb..ebf68d02d9983305ad2ea2fbaeaa8602dfe021d2 100644 --- a/internal/agent/tools/fetch.go +++ b/internal/agent/tools/fetch.go @@ -18,7 +18,7 @@ import ( const ( FetchToolName = "fetch" - MaxFetchSize = 1 * 1024 * 1024 // 1MB + MaxFetchSize = 100 * 1024 // 100KB ) //go:embed fetch.md diff --git a/internal/agent/tools/fetch.md b/internal/agent/tools/fetch.md index 1dabf06bfe847ec92295f0bf054902b78c08fb40..f468fe9706cf30c21bba2fef826f093cda9d8b70 100644 --- a/internal/agent/tools/fetch.md +++ b/internal/agent/tools/fetch.md @@ -1,4 +1,4 @@ -Fetch raw content from a URL as text, markdown, or html (max 5MB); no AI processing. For analysis or extraction use agentic_fetch. +Fetch raw content from a URL as text, markdown, or html (max 100KB); no AI processing. For analysis or extraction use agentic_fetch. Use this tool when you need: @@ -29,7 +29,7 @@ DO NOT use this tool when you need to: -- Max response size: 5MB +- Max response size: 100KB - Only supports HTTP and HTTPS protocols - Cannot handle authentication or cookies - Some websites may block automated requests diff --git a/internal/agent/tools/view.go b/internal/agent/tools/view.go index efacba1423ee0acafb8361537982af47ffbf74a1..2db923bb09e04cb630156eb794c457afa456da59 100644 --- a/internal/agent/tools/view.go +++ b/internal/agent/tools/view.go @@ -53,7 +53,7 @@ type ViewResponseMetadata struct { const ( ViewToolName = "view" - MaxViewSize = 1 * 1024 * 1024 // 1MB + MaxViewSize = 100 * 1024 // 100KB DefaultReadLimit = 2000 MaxLineLength = 2000 ) diff --git a/internal/agent/tools/view.md b/internal/agent/tools/view.md index 99460ea66ebf26b3dc6d409a1e9230d8d53b83ab..598d90da75b77d183791419c7d34efdea090f7c8 100644 --- a/internal/agent/tools/view.md +++ b/internal/agent/tools/view.md @@ -1,4 +1,4 @@ -Read a file by path with line numbers; supports offset and line limit (default 2000, max 5MB); renders images (PNG, JPEG, GIF, BMP, SVG, WebP); use ls for directories. +Read a file by path with line numbers; supports offset and line limit (default 2000, max 100KB); renders images (PNG, JPEG, GIF, BMP, SVG, WebP); use ls for directories. - Provide file path to read @@ -18,7 +18,7 @@ Read a file by path with line numbers; supports offset and line limit (default 2 -- Max file size: 5MB +- Max file size: 100KB - Default limit: 2000 lines - Lines >2000 chars truncated - Binary files (except images) cannot be displayed