Function
createTimeoutPromise
(
serverName: string,
tool: string,
timeoutMs: number,
)
Source from the content-addressed store, hash-verified
| 156 | } |
| 157 | |
| 158 | function createTimeoutPromise( |
| 159 | serverName: string, |
| 160 | tool: string, |
| 161 | timeoutMs: number, |
| 162 | ): Promise<never> { |
| 163 | return new Promise((_, reject) => { |
| 164 | const timeoutId = setTimeout(() => { |
| 165 | reject( |
| 166 | new Error( |
| 167 | `MCP server "${serverName}" tool "${tool}" timed out after ${Math.floor(timeoutMs / 1000)}s`, |
| 168 | ), |
| 169 | ) |
| 170 | }, timeoutMs) |
| 171 | timeoutId.unref?.() |
| 172 | }) |
| 173 | } |
Tested by
no test coverage detected