(rootPath: string)
| 709 | } |
| 710 | |
| 711 | async function validateResolvedProjectPath(rootPath: string): Promise<ToolResponse | undefined> { |
| 712 | try { |
| 713 | const stats = await fs.stat(rootPath); |
| 714 | if (!stats.isDirectory()) { |
| 715 | return buildProjectSelectionError( |
| 716 | 'unknown_project', |
| 717 | `project is not a directory: ${rootPath}` |
| 718 | ); |
| 719 | } |
| 720 | |
| 721 | if (clientRootsEnabled && getKnownRootPaths().length > 0 && !getContainingKnownRoot(rootPath)) { |
| 722 | return buildProjectSelectionError( |
| 723 | 'unknown_project', |
| 724 | 'Requested project is not under an active MCP root.' |
| 725 | ); |
| 726 | } |
| 727 | |
| 728 | return undefined; |
| 729 | } catch { |
| 730 | return buildProjectSelectionError('unknown_project', `project does not exist: ${rootPath}`); |
| 731 | } |
| 732 | } |
| 733 | |
| 734 | async function resolveProjectSelector(selector: string): Promise<ProjectResolution> { |
| 735 | const trimmedSelector = selector.trim(); |
no test coverage detected