Fix read tool token limit - reduce to 20k for MCP overhead

- Reduced max_tokens from 25000 → 20000
- Prevents 'response exceeds maximum allowed tokens' errors
- Leaves buffer for MCP protocol overhead

Fixes: read tool returning 27444 tokens (exceeds 25000 limit)
This commit is contained in:
2025-10-14 21:34:14 -07:00
parent 1d9cee301c
commit 8a9072ecbe
@@ -212,9 +212,10 @@ Usage:
await tool_ctx.info(f"Successfully read file: {file_path}")
# Apply token limit to prevent excessive output
# Reduce to 20000 to leave buffer for MCP overhead
return truncate_response(
result,
max_tokens=25000,
max_tokens=20000,
truncation_message="\n\n[File content truncated due to token limit. Use offset/limit parameters to read specific sections.]",
)