claude-flow icon indicating copy to clipboard operation
claude-flow copied to clipboard

Server integration for TTL/LRU toolset eviction (follow-up to #14)

Open coderabbitai[bot] opened this issue 3 months ago • 1 comments

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.listChanged events after evictions to sync tool list changes

3. Discovery Tools Registration

  • Register gate/pin_toolset discovery tool for pinning toolsets
  • Register gate/unpin_toolset discovery 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.listChanged events emitted after evictions
  • [ ] Integration tested to ensure eviction works end-to-end

coderabbitai[bot] avatar Sep 09 '25 00:09 coderabbitai[bot]

@ruvnet appologies, for some reason @Coderabbitai posts issues from my fork into your main. Please disregard.

KHAEntertainment avatar Sep 09 '25 00:09 KHAEntertainment