* Sanitize condition blocks by removing UI-specific metadata * Returns cleaned JSON string (not parsed array)
(conditionsJson: string)
| 147 | * Returns cleaned JSON string (not parsed array) |
| 148 | */ |
| 149 | function sanitizeConditions(conditionsJson: string): string { |
| 150 | try { |
| 151 | const conditions: unknown = JSON.parse(conditionsJson) |
| 152 | if (!Array.isArray(conditions)) return conditionsJson |
| 153 | |
| 154 | // Keep only id, title, and value - remove UI state |
| 155 | const cleaned: SanitizedCondition[] = conditions.map(toSanitizedCondition) |
| 156 | |
| 157 | return JSON.stringify(cleaned) |
| 158 | } catch { |
| 159 | return conditionsJson |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | /** Tool input structure for sanitization */ |
| 164 | interface ToolInput { |
no test coverage detected