First usable filesystem path from a `roots/list` result, or null.
(result: unknown)
| 126 | |
| 127 | /** First usable filesystem path from a `roots/list` result, or null. */ |
| 128 | function firstRootPath(result: unknown): string | null { |
| 129 | if (!result || typeof result !== 'object') return null; |
| 130 | const roots = (result as { roots?: unknown }).roots; |
| 131 | if (!Array.isArray(roots) || roots.length === 0) return null; |
| 132 | const first = roots[0] as { uri?: unknown }; |
| 133 | if (typeof first?.uri !== 'string') return null; |
| 134 | return fileUriToPath(first.uri); |
| 135 | } |
| 136 | |
| 137 | export interface MCPSessionOptions { |
| 138 | /** |
no test coverage detected