First usable filesystem path from a `roots/list` result, or null.
(result: unknown)
| 82 | |
| 83 | /** First usable filesystem path from a `roots/list` result, or null. */ |
| 84 | function firstRootPath(result: unknown): string | null { |
| 85 | if (!result || typeof result !== 'object') return null; |
| 86 | const roots = (result as { roots?: unknown }).roots; |
| 87 | if (!Array.isArray(roots) || roots.length === 0) return null; |
| 88 | const first = roots[0] as { uri?: unknown }; |
| 89 | if (typeof first?.uri !== 'string') return null; |
| 90 | return fileUriToPath(first.uri); |
| 91 | } |
| 92 | |
| 93 | export interface MCPSessionOptions { |
| 94 | /** |
no test coverage detected