Rate limit guard - limits the number of requests per time window This is a simple in-memory implementation. For production, use Redis or similar.
@Injectable()class MyToolProvider { @UseMCPGuards(RateLimitGuard) @MCPTool({ name: 'expensive_tool', description: 'Rate limited tool' }) async expensiveTool() { return 'Result'; }} Copy
@Injectable()class MyToolProvider { @UseMCPGuards(RateLimitGuard) @MCPTool({ name: 'expensive_tool', description: 'Rate limited tool' }) async expensiveTool() { return 'Result'; }}
Optional
Determine if the operation can proceed
true if allowed, false if denied, or throws an exception
Rate limit guard - limits the number of requests per time window This is a simple in-memory implementation. For production, use Redis or similar.
Example