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

Method register_tool_request_intercept

crates/core/src/plugin.rs:620–647  ·  view source on GitHub ↗

Registers a tool request intercept and records its rollback closure.

(
        &mut self,
        name: &str,
        priority: i32,
        break_chain: bool,
        callback: ToolInterceptFn,
    )

Source from the content-addressed store, hash-verified

618
619 /// Registers a tool request intercept and records its rollback closure.
620 pub fn register_tool_request_intercept(
621 &mut self,
622 name: &str,
623 priority: i32,
624 break_chain: bool,
625 callback: ToolInterceptFn,
626 ) -> Result<()> {
627 let qualified_name = self.qualify_name(name);
628 register_tool_request_intercept(&qualified_name, priority, break_chain, callback).map_err(
629 |err| PluginError::RegistrationFailed(format!("tool request intercept: {err}")),
630 )?;
631
632 let name_owned = qualified_name;
633 self.registrations.push(PluginRegistration::new(
634 "plugin",
635 name_owned.clone(),
636 Box::new(move || {
637 deregister_tool_request_intercept(&name_owned)
638 .map(|_| ())
639 .map_err(|err| {
640 PluginError::RegistrationFailed(format!(
641 "tool request intercept deregistration failed: {err}"
642 ))
643 })
644 }),
645 ));
646 Ok(())
647 }
648
649 /// Registers a tool execution intercept and records its rollback closure.
650 pub fn register_tool_execution_intercept(

Calls 4

qualify_nameMethod · 0.45
pushMethod · 0.45