First usable filesystem path from a `roots/list` result, or null.
(result: unknown)
| 167 | |
| 168 | /** First usable filesystem path from a `roots/list` result, or null. */ |
| 169 | function firstRootPath(result: unknown): string | null { |
| 170 | if (!result || typeof result !== 'object') return null; |
| 171 | const roots = (result as { roots?: unknown }).roots; |
| 172 | if (!Array.isArray(roots) || roots.length === 0) return null; |
| 173 | const first = roots[0] as { uri?: unknown }; |
| 174 | if (typeof first?.uri !== 'string') return null; |
| 175 | return fileUriToPath(first.uri); |
| 176 | } |
| 177 | |
| 178 | export interface MCPSessionOptions { |
| 179 | /** |
no test coverage detected