sourcebot/packages
Wayne Sun 278c0dc556
fix: return truncated content when token limit exceeded in MCP search_code (#604)
When search results exceed maxTokens limit, now returns partial truncated
content instead of discarding the file completely.

Changes:
- Calculate remaining token budget before breaking
- Truncate file content to fit within remaining tokens (if > 100 tokens left)
- Append truncation marker to indicate content was cut off
- Still add truncation message at end of all results

Benefits:
- Users get partial data instead of nothing
- Better debugging and analysis experience
- More useful for AI-powered code analysis tasks
- Consistent with expected behavior when limits are reached

Example: If file would use 10K tokens but only 2K remain, return
first ~8K chars of content + truncation marker instead of dropping it.

Signed-off-by: Wayne Sun <gsun@redhat.com>
2025-11-10 15:23:56 -08:00
..
backend fix(worker): Run setInterval as blocking (#607) 2025-11-09 14:49:24 -08:00
db feat(web,worker): Environment overrides (#597) 2025-11-04 21:22:31 -08:00
mcp fix: return truncated content when token limit exceeded in MCP search_code (#604) 2025-11-10 15:23:56 -08:00
schemas feat(web,worker): Environment overrides (#597) 2025-11-04 21:22:31 -08:00
shared feat(web,worker): Environment overrides (#597) 2025-11-04 21:22:31 -08:00
web fix discord links (#606) 2025-11-07 10:05:05 -08:00