| 224 | } |
| 225 | |
| 226 | async fn check_tool_input(&self, tool_name: &str, args: &Json) -> FlowResult<Json> { |
| 227 | let messages = vec![json!({ |
| 228 | "role": "user", |
| 229 | "content": tool_input_content(tool_name, args)?, |
| 230 | })]; |
| 231 | |
| 232 | match self.bridge.check(messages, LocalRailKind::Input).await? { |
| 233 | LocalCheckOutcome::Passed => Ok(args.clone()), |
| 234 | LocalCheckOutcome::Blocked { rail, .. } => { |
| 235 | Err(blocked_error("tool_input", rail.as_deref())) |
| 236 | } |
| 237 | LocalCheckOutcome::Modified { content, .. } => { |
| 238 | modified_tool_payload(&content, "arguments") |
| 239 | } |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | async fn check_tool_output( |
| 244 | &self, |