perf(tools): lower default result sizes to cut response tokens

The default limits let broad queries flood the model context. This
change sets smaller defaults. An explicit parameter still overrides each one.

- file_search: max_results 1000 to 50, context_lines 2 to 0.
- ast_query: max_results 100 to 50.
- ast_query compact output omits the node type unless verbose is set.

On a fixed seven-call suite, response size fell from 198529 to 61960 bytes.
This commit is contained in:
2026-09-30 00:20:19 +01:00
parent f4f5135ac2
commit 2158228ddb
8 changed files with 16 additions and 12 deletions
+5 -1
View File
@@ -509,11 +509,15 @@ func formatResults(results []MatchResult, maxResults int, format string, offset
case "compact":
for i := 0; i < renderCount; i++ {
r := results[i]
firstLine := firstLineOf(r.Text, 80)
if !verbose {
fmt.Fprintf(&sb, "%s:%d %s\n", r.File, r.Location.Line, firstLine)
continue
}
nodeType := "unknown"
if r.Node != nil {
nodeType = r.Node.Type()
}
firstLine := firstLineOf(r.Text, 80)
fmt.Fprintf(&sb, "%s:%d (%s) %s\n", r.File, r.Location.Line, nodeType, firstLine)
}