feat(ast_query): default to compact format for token efficiency

ast_query defaulted to verbose output (full code + up to 500 chars/match + captures), which is very token-heavy on multi-match queries. Default to compact (one line per match: file:line (kind) firstline) — roughly 5-10x fewer tokens on typical queries — while verbose remains available per-call (format=verbose) or via the default_format session pref. Updates tool description, help resource, and TestASTQueryFormatCompactDefault.
This commit is contained in:
2026-06-20 00:33:32 +01:00
parent b2c4101b5b
commit dfd68f08c9
4 changed files with 24 additions and 10 deletions
+4 -1
View File
@@ -67,7 +67,10 @@ func (s *Server) resolveASTQueryParams(request mcp.CallToolRequest) (*astQueryPa
if prefsFormat != "" {
p.format = prefsFormat
} else {
p.format = "verbose"
// Default to compact (one line per match): far fewer tokens than
// verbose (full code + captures) on multi-match queries. Callers can
// opt into verbose per-call or via the default_format session pref.
p.format = "compact"
}
}