MCPcopy Create free account
hub / github.com/NVIDIA/NeMo-Relay / check_tool_output

Method check_tool_output

crates/core/src/plugins/nemo_guardrails/python.rs:243–269  ·  view source on GitHub ↗
(
        &self,
        tool_name: &str,
        args: &Json,
        result: &Json,
    )

Source from the content-addressed store, hash-verified

241 }
242
243 async fn check_tool_output(
244 &self,
245 tool_name: &str,
246 args: &Json,
247 result: &Json,
248 ) -> FlowResult<Json> {
249 let messages = vec![
250 json!({
251 "role": "user",
252 "content": tool_input_content(tool_name, args)?,
253 }),
254 json!({
255 "role": "assistant",
256 "content": tool_output_content(tool_name, args, result)?,
257 }),
258 ];
259
260 match self.bridge.check(messages, LocalRailKind::Output).await? {
261 LocalCheckOutcome::Passed => Ok(result.clone()),
262 LocalCheckOutcome::Blocked { rail, .. } => {
263 Err(blocked_error("tool_output", rail.as_deref()))
264 }
265 LocalCheckOutcome::Modified { content, .. } => {
266 modified_tool_payload(&content, "result")
267 }
268 }
269 }
270
271 async fn guard_provider_stream(
272 &self,

Calls 3

blocked_errorFunction · 0.85
modified_tool_payloadFunction · 0.85
checkMethod · 0.45