feat: implement size-limited LRU cache for JSON Schema validation by joaquinescalante23 · Pull Request #845 · modelcontextprotocol/java-sdk

I've been following the architectural changes proposed in PR #749 by @tzolov. While that PR focuses on the extensibility of the validator through suppliers, this PR addresses a critical resource management issue in the current default implementation.

Specifically, the existing DefaultJsonSchemaValidator (Jackson 2 and 3) lacks a cache eviction policy, which poses a memory exhaustion risk in long-running applications or when dealing with dynamic tool schemas. My proposal introduces a size-configurable LRU Cache that would make the new supplier-based architecture much more robust by default.

I'm happy to rebase or adjust this PR to align with the new supplier patterns once #749 is merged. Let me know if you'd like me to integrate these resilience improvements into the new supplier structure!