claude-flow
claude-flow copied to clipboard
Server integration for TTL/LRU toolset eviction (follow-up to #14)
Background
This issue is a follow-up to PR #18 and issue #14. While the core TTL/LRU eviction functionality has been implemented in the ToolGateController, the server integration components are still missing.
Missing Server Integration Requirements
The following server-side changes need to be implemented in src/mcp/server.ts:
1. Mark Usage on Tool Calls
- Call
markUsed(toolName)on each tools/call to update last-used timestamps - This ensures the TTL tracking accurately reflects tool usage
2. Periodic Maintenance
- Schedule periodic calls to
sweepExpiredToolsets()to remove expired toolsets - Call
enforceLRUCap()after enabling new toolsets to maintain capacity limits - Emit
tools.listChangedevents after evictions to sync tool list changes
3. Discovery Tools Registration
- Register
gate/pin_toolsetdiscovery tool for pinning toolsets - Register
gate/unpin_toolsetdiscovery tool for unpinning toolsets - These tools should allow clients to protect toolsets from auto-disable
References
- Original issue: #14
- Implementation PR: #18
- Related comment: https://github.com/KHAEntertainment/claude-flow/pull/18#issuecomment-IC_kwDOO07yic61L2Lh
Acceptance Criteria
- [ ] `markUsed()) called on every tool execution in server.ts
- [ ] Periodic sweeping and LRU enforcement implemented
- [ ] Discovery tools for pin/unpin operations registered
- [ ]
tools.listChangedevents emitted after evictions - [ ] Integration tested to ensure eviction works end-to-end
@ruvnet appologies, for some reason @Coderabbitai posts issues from my fork into your main. Please disregard.