MCPcopy Create free account
hub / github.com/InfinitiBit/graphbit / add_to_history

Method add_to_history

python/src/tools/registry.rs:403–420  ·  view source on GitHub ↗

Add result to execution history (internal method)

(&self, result: ToolResult)

Source from the content-addressed store, hash-verified

401
402 /// Add result to execution history (internal method)
403 fn add_to_history(&self, result: ToolResult) -> PyResult<()> {
404 let mut history = self.execution_history.write().map_err(|e| {
405 PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(format!(
406 "Failed to acquire history lock: {}",
407 e
408 ))
409 })?;
410
411 history.push(result);
412
413 // Keep only last 1000 executions to prevent memory bloat
414 if history.len() > 1000 {
415 let len = history.len();
416 history.drain(0..len - 1000);
417 }
418
419 Ok(())
420 }
421}
422
423impl Default for ToolRegistry {

Callers 1

execute_toolMethod · 0.80

Calls 1

lenMethod · 0.80

Tested by

no test coverage detected