refactor: Enforce strict typed JsonSchema for all MCP tools
This commit is contained in:
1 parent
686fea683d
commit
2d3aaed289
31 files changed
+2892
-308
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import re
|
||||
|
||||
with open("server/src/state.rs", "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
|
||||
# Add git_branch and namespace to Entity initialization
|
||||
content = content.replace("observations: Vec::new(),", "observations: Vec::new(),\n namespace: src_ent.namespace.clone(),\n git_branch: src_ent.git_branch.clone(),")
|
||||
|
||||
# Add unique_items back
|
||||
unique_items_code = """
|
||||
pub fn unique_items<T: Eq + std::hash::Hash + Clone>(input: Vec<T>) -> Vec<T> {
|
||||
let mut keys = std::collections::HashSet::new();
|
||||
input.into_iter().filter(|entry| keys.insert(entry.clone())).collect()
|
||||
}
|
||||
"""
|
||||
|
||||
content = content.replace("impl MemoryState {\n", "impl MemoryState {\n" + unique_items_code)
|
||||
|
||||
with open("server/src/state.rs", "w", encoding="utf-8") as f:
|
||||
f.write(content)
|
||||
|
||||
Reference in new issue
Block a user