Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions internal/server/rate_limit.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ func extractRateLimitErrorText(result interface{}) string {
func isRateLimitToolResult(result interface{}) (bool, time.Time) {
m, ok := result.(map[string]interface{})
if !ok {
logCircuitBreaker.Print("isRateLimitToolResult: result is not a map, not a rate limit result")
return false, time.Time{}
}

// Only inspect error results.
if !mcpresult.IsErrorResult(m) {
logCircuitBreaker.Print("isRateLimitToolResult: result is not an error result, skipping rate-limit check")
return false, time.Time{}
}

Expand All @@ -47,5 +49,6 @@ func isRateLimitToolResult(result interface{}) (bool, time.Time) {
logCircuitBreaker.Printf("Rate limit detected in tool result: hasResetAt=%v", !resetAt.IsZero())
return true, resetAt
}
logCircuitBreaker.Print("isRateLimitToolResult: error result did not match rate-limit text patterns")
return false, time.Time{}
}
Loading