feat: provider-wide output compaction/truncation layer for CLI tool results
Maintainer antworten meist innerhalb von 5 Tagen
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 25/100
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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
- Vorherrschende Sprache
- Go
- Sterne
- 39
- Forks
- 35
- Ø Merge
- 4 T. 10 Std.
- Gemergte PRs (30 T.)
- 8
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Kein Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus kagent-dev/tools
-
LLM-backed tools are registered without an LLMEvtl. vergeben @ntmspavan hat das vor 7 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 67/100
kagent-dev/tools#93 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 5 Tagen
-
Helm chart sets env vars the server never readsEvtl. vergeben @lbarrosby hat das vor 11 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 67/100
kagent-dev/tools#92 ·
Maintainer antworten meist innerhalb von 5 Tagen
-
[BUG] Failed commands return only "exit status 1"; the command's error never reaches the agentEvtl. vergeben @sathpal hat das vor 34 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 69/100
kagent-dev/tools#89 ·
Maintainer antworten meist innerhalb von 5 Tagen
-
[BUG] MCP clients get no tools from v0.3.0: kubescape_get_vulnerability_details outputSchema is not an objectEvtl. wieder frei @nishanthchandr4 hat das vor 48 Tagen übernommen, und es ist kein Pull Request offen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
kagent-dev/tools#87 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 5 Tagen
-
Tool calls produce no span and the kubectl subprocess drops trace contextEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
kagent-dev/tools#102 ·
Maintainer antworten meist innerhalb von 5 Tagen
Alle Issues in kagent-dev/tools
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 82/100
-
Add CybeDefendOffen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 66/100
slavakurilyak/awesome-ai-agents#1031 ·