MCPcopy Index your code
hub / github.com/InfinitiBit/graphbit / unregister_tool

Method unregister_tool

python/src/tools/registry.rs:156–175  ·  view source on GitHub ↗

Unregister a tool

(&self, name: &str)

Source from the content-addressed store, hash-verified

154
155 /// Unregister a tool
156 pub fn unregister_tool(&self, name: &str) -> PyResult<bool> {
157 let mut tools = self.tools.write().map_err(|e| {
158 PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(format!(
159 "Failed to acquire tools lock: {}",
160 e
161 ))
162 })?;
163
164 let mut metadata = self.metadata.write().map_err(|e| {
165 PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(format!(
166 "Failed to acquire metadata lock: {}",
167 e
168 ))
169 })?;
170
171 let removed_tool = tools.remove(name).is_some();
172 let removed_meta = metadata.remove(name).is_some();
173
174 Ok(removed_tool || removed_meta)
175 }
176
177 /// Check if a tool is registered
178 pub fn has_tool(&self, name: &str) -> PyResult<bool> {

Callers 1

Calls 1

removeMethod · 0.80

Tested by 1