First usable filesystem path from a `roots/list` result, or null.
(result: unknown)
| 60 | |
| 61 | /** First usable filesystem path from a `roots/list` result, or null. */ |
| 62 | function firstRootPath(result: unknown): string | null { |
| 63 | if (!result || typeof result !== 'object') return null; |
| 64 | const roots = (result as { roots?: unknown }).roots; |
| 65 | if (!Array.isArray(roots) || roots.length === 0) return null; |
| 66 | const first = roots[0] as { uri?: unknown }; |
| 67 | if (typeof first?.uri !== 'string') return null; |
| 68 | return fileUriToPath(first.uri); |
| 69 | } |
| 70 | |
| 71 | export interface MCPSessionOptions { |
| 72 | /** |
no test coverage detected