Timeout interceptor - ensures operations complete within a time limit
@Injectable()class MyToolProvider { @UseMCPInterceptors(new TimeoutInterceptor(5000)) // 5 second timeout @MCPTool({ name: 'slow_tool', description: 'Tool with timeout' }) async slowTool() { // Long running operation return 'Result'; }} Copy
@Injectable()class MyToolProvider { @UseMCPInterceptors(new TimeoutInterceptor(5000)) // 5 second timeout @MCPTool({ name: 'slow_tool', description: 'Tool with timeout' }) async slowTool() { // Long running operation return 'Result'; }}
Intercept the handler execution
Execution context
Call handler function
The result or a transformed result
Timeout interceptor - ensures operations complete within a time limit
Example