* Validate an optional path-like string input. Returns the value if * valid (or undefined), or a ToolResult with the error.
(
value: unknown,
name: string
)
| 2823 | * valid (or undefined), or a ToolResult with the error. |
| 2824 | */ |
| 2825 | private validateOptionalPath( |
| 2826 | value: unknown, |
| 2827 | name: string |
| 2828 | ): string | undefined | ToolResult { |
| 2829 | if (value === undefined || value === null) return undefined; |
| 2830 | if (typeof value !== 'string') { |
| 2831 | return this.errorResult(`${name} must be a string`); |
| 2832 | } |
| 2833 | if (value.length > MAX_PATH_LENGTH) { |
| 2834 | return this.errorResult( |
| 2835 | `${name} exceeds maximum length of ${MAX_PATH_LENGTH} characters (got ${value.length})` |
| 2836 | ); |
| 2837 | } |
| 2838 | return value; |
| 2839 | } |
| 2840 | |
| 2841 | /** |
| 2842 | * Cached git worktree/index mismatch for a tool call's effective project. |