( server: Pick<McpServer, 'close'> | null | undefined, timeoutMs: number, )
| 137 | } |
| 138 | |
| 139 | export async function closeServerWithTimeout( |
| 140 | server: Pick<McpServer, 'close'> | null | undefined, |
| 141 | timeoutMs: number, |
| 142 | ): Promise<'skipped' | 'closed' | 'timed_out' | 'rejected'> { |
| 143 | if (!server) { |
| 144 | return 'skipped'; |
| 145 | } |
| 146 | |
| 147 | const outcome = await runStep('server.close', timeoutMs, () => server.close()); |
| 148 | if (outcome.status === 'completed') { |
| 149 | return 'closed'; |
| 150 | } |
| 151 | if (outcome.status === 'timed_out') { |
| 152 | return 'timed_out'; |
| 153 | } |
| 154 | return 'rejected'; |
| 155 | } |
| 156 | |
| 157 | export async function runMcpShutdown(input: { |
| 158 | reason: McpShutdownReason; |
no test coverage detected