sourcebot/packages
Wayne Sun a1da34aa9a fix: return truncated content when token limit exceeded in MCP search_code
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-07 13:23:58 -05:00
..
backend feat(web,worker): Environment overrides (#597) 2025-11-04 21:22:31 -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 2025-11-07 13:23:58 -05: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 typo in linked account settings 2025-11-04 21:26:19 -08:00