feat: provider-wide output compaction/truncation layer for CLI tool results
Maintainer thường phản hồi trong vòng 5 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Start by reading the implementation of k8s_get_resources from #83 and how providers return results through mcp.TextOutput; the issue names internal/commands and mcp.TextResult as possible integration points. Work out how output formats, structured content, configuration, and metrics should fit together. Done means a shared layer reduces oversized provider output safely and clearly reports truncation, with the open design questions resolved.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
#83 (closing #82) adds a limit parameter to k8s_get_resources to cap result size. That fixes one tool, but the underlying problem is general: almost every provider returns raw CLI output (kubectl, helm, istioctl, cilium, argo, kubescape, ...) straight into the model's context via mcp.TextOutput. Large outputs (cluster-wide listings, describe, logs, proxy-config dumps, scan reports) can blow up token usage and exhaust the context window.
Rather than adding ad-hoc limits per tool, we should consider a shared output-reduction layer, inspired by rtk-ai/rtk — a CLI proxy that reduces LLM token consumption by 60–90% on common dev commands by filtering/compacting command output.
Proposal
Add a shared component in internal/ (e.g. alongside internal/commands or as a post-processor applied in mcp.TextResult) that:
- Truncates safely per format — row-based for tabular output (preserving headers),
items-level for JSON, passthrough for formats without a safe cut point (generalizing the approach in #83). - Always emits an explicit truncation notice with totals and how to narrow the query, so partial data is never mistaken for complete data.
- Compacts noisy output — e.g. strip
managedFields,last-applied-configurationannotations, empty/default fields, collapse repeated log lines, dedupe events. - Is configurable — global defaults via server flags/env/Helm values (e.g. max bytes/rows/tokens), with per-call overrides (
limit=0to disable) where it makes sense. - Is observable — metrics for bytes in/out and truncation counts per tool/provider.
Open questions
- Default on (bounded) vs opt-in? (Same trade-off raised in #83.)
- Size budget unit: rows, bytes, or estimated tokens?
- Should per-command filters live in Go code, or be declarative/config-driven like rtk's filters?
- How does this interact with
StructuredContentand output schema validation?
References
- #82, #83 —
limitfork8s_get_resources - https://github.com/rtk-ai/rtk
- Ngôn ngữ chính
- Go
- Star
- 39
- Fork
- 35
- Merge trung bình
- 4 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 8
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của kagent-dev/tools
-
LLM-backed tools are registered without an LLMCó thể đã có người làm @ntmspavan đã nhận 7 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
kagent-dev/tools#93 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Helm chart sets env vars the server never readsCó thể đã có người làm @lbarrosby đã nhận 11 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
kagent-dev/tools#92 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
[BUG] Failed commands return only "exit status 1"; the command's error never reaches the agentCó thể đã có người làm @sathpal đã nhận 34 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
kagent-dev/tools#89 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
[BUG] MCP clients get no tools from v0.3.0: kubescape_get_vulnerability_details outputSchema is not an objectCó thể làm lại được @nishanthchandr4 đã nhận 48 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
kagent-dev/tools#87 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Tool calls produce no span and the kubectl subprocess drops trace contextCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
kagent-dev/tools#102 ·
Maintainer thường phản hồi trong vòng 5 ngày
Tất cả issue của kagent-dev/tools
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Add CybeDefendĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 66/100
slavakurilyak/awesome-ai-agents#1031 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
kagent-dev/kagent#3792 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ai-driven-qa bug claude Minor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
linagora/cozy-stack#5374 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
new-compilers request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
compiler-explorer/compiler-explorer#9640 ·
Maintainer thường phản hồi trong vòng 1 ngày