MCPcopy Index your code
hub / github.com/AI45Lab/Code / put

Method put

core/src/tools/artifacts.rs:67–80  ·  view source on GitHub ↗
(&self, artifact: ToolArtifact)

Source from the content-addressed store, hash-verified

65 }
66
67 pub fn put(&self, artifact: ToolArtifact) {
68 let mut state = self.inner.write().unwrap();
69 let artifact_uri = artifact.artifact_uri.clone();
70 if let Some(existing) = state.artifacts.remove(&artifact_uri) {
71 state.total_bytes = state.total_bytes.saturating_sub(existing.content.len());
72 state.insertion_order.retain(|uri| uri != &artifact_uri);
73 }
74
75 state.total_bytes += artifact.content.len();
76 state.insertion_order.push_back(artifact_uri.clone());
77 state.artifacts.insert(artifact_uri, artifact);
78
79 self.enforce_limits(&mut state);
80 }
81
82 pub fn get(&self, artifact_uri: &str) -> Option<ToolArtifact> {
83 self.inner

Calls 6

writeMethod · 0.80
removeMethod · 0.80
enforce_limitsMethod · 0.80
cloneMethod · 0.45
lenMethod · 0.45
insertMethod · 0.45