-
Notifications
You must be signed in to change notification settings - Fork 36
mcp: tool descriptions cause inefficient agent usage — agents read full files and exceed token limits #161
Copy link
Copy link
Closed
Description
Problem
Agents using codedb MCP tools produce wasteful query patterns that result in multi-megabyte responses exceeding token limits. This was reported in #160 where Claude Opus 4.6 generated 3.2M character bundle responses.
Root Cause
The MCP tool descriptions do not guide agents toward efficient usage patterns. Specifically:
codedb_readdescription says "Read file contents" — agents use it to read entire files instead of usingcodedb_outlinefirstcodedb_bundledescription says "max 20 ops" but does not warn about response size — agents bundle 6+codedb_readcalls producing megabytes of outputcodedb_searchwithmax_results=30on broad queries returns hundreds of KB- No description tells agents: "use
outlinefirst, thensymbolorreadwith line ranges"
Failing Test
test "issue-160: bundle with multiple full reads should warn about size" {
// A bundle of 6 codedb_read calls on large files should either:
// 1. Truncate output to a reasonable size, or
// 2. Return an error suggesting outline + targeted reads
}Proposed Fix
-
Improve tool descriptions in
src/mcp.zigtools_list:codedb_read: Add "Use codedb_outline first to understand file structure, then read specific line ranges. Avoid reading entire large files."codedb_bundle: Add "Warning: total response is capped at 100KB. Use outline + targeted reads, not full file reads."codedb_search: Add "For broad queries, start with max_results=10. Use scope=true for context."codedb_outline: Add "START HERE — use this first to understand any file before reading it."
-
Add response size cap to bundle — if total response exceeds 100KB, truncate and return a warning
-
Add
codedb_readsize warning — if reading a file >50KB without line range, suggest using outline instead
Environment
- codedb v0.2.53
- Claude Code Opus 4.6, max effort
Related
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels