(value: any)
| 6 | * @returns A formatted string representation of the value |
| 7 | */ |
| 8 | export function formatToolArgument(value: any): string { |
| 9 | if (value === null || value === undefined) { |
| 10 | return ""; |
| 11 | } |
| 12 | |
| 13 | // Convert absolute paths to relative paths |
| 14 | if (typeof value === "string" && path.isAbsolute(value)) { |
| 15 | const workspaceRoot = process.cwd(); |
| 16 | const relativePath = path.relative(workspaceRoot, value); |
| 17 | // Normalize path separators to forward slashes for cross-platform consistency |
| 18 | return (relativePath || value).replace(/\\/g, "/"); |
| 19 | } |
| 20 | |
| 21 | // Return other values as strings |
| 22 | return String(value); |
| 23 | } |
no test coverage detected