()
| 268 | let index = 0; |
| 269 | |
| 270 | const executeLayer = (): Promise<unknown> => { |
| 271 | const entry = applicable[index++]; |
| 272 | if (!entry) { |
| 273 | if (rawRequest) { |
| 274 | rawRequest.params = mcpRequest.params; |
| 275 | } |
| 276 | return originalHandler(...args); |
| 277 | } |
| 278 | |
| 279 | let nextCalled = false; |
| 280 | |
| 281 | const next = (): Promise<unknown> => { |
| 282 | if (nextCalled) { |
| 283 | throw new Error( |
| 284 | `next() called multiple times in middleware for "${method}"`, |
| 285 | ); |
| 286 | } |
| 287 | nextCalled = true; |
| 288 | return executeLayer(); |
| 289 | }; |
| 290 | |
| 291 | return Promise.resolve(entry.handler(mcpRequest, extra, next)); |
| 292 | }; |
| 293 | |
| 294 | return executeLayer(); |
| 295 | }; |
no outgoing calls
no test coverage detected