| 217 | } |
| 218 | |
| 219 | func sanitizeToolInvokeResponse(response ToolInvokeResponseRecord) ToolInvokeResponseRecord { |
| 220 | response.Result.Preview = redactToolDiagnostic(response.Result.Preview) |
| 221 | response.Result.Structured = redactToolRawJSON(response.Result.Structured) |
| 222 | response.Result.Metadata = redactToolMetadata(response.Result.Metadata) |
| 223 | for i := range response.Result.Content { |
| 224 | response.Result.Content[i].Text = redactToolDiagnostic(response.Result.Content[i].Text) |
| 225 | response.Result.Content[i].Data = redactToolRawJSON(response.Result.Content[i].Data) |
| 226 | response.Result.Content[i].Metadata = redactToolMetadata(response.Result.Content[i].Metadata) |
| 227 | } |
| 228 | return response |
| 229 | } |
| 230 | |
| 231 | func redactToolRawJSON(raw json.RawMessage) json.RawMessage { |
| 232 | if len(raw) == 0 { |