1
0
This commit is contained in:
2026-03-01 17:04:55 +09:00
parent 9c8907fd5c
commit 059ccdc5c6

View File

@@ -61,6 +61,7 @@ impl MCPServer {
}
fn handle_initialize(&self, id: Value) -> Value {
let instructions = self.build_instructions();
json!({
"jsonrpc": "2.0",
"id": id,
@@ -72,11 +73,34 @@ impl MCPServer {
"serverInfo": {
"name": "aigpt",
"version": "0.3.0"
}
},
"instructions": instructions
}
})
}
fn build_instructions(&self) -> String {
let mut parts = Vec::new();
if let Ok(core) = reader::read_core() {
if let Some(text) = core["value"]["content"]["text"].as_str() {
if !text.is_empty() {
parts.push(text.to_string());
}
}
}
if let Ok(Some(memory)) = reader::read_memory() {
if let Some(text) = memory["value"]["content"]["text"].as_str() {
if !text.is_empty() {
parts.push(text.to_string());
}
}
}
parts.join("\n\n")
}
fn handle_tools_list(&self, id: Value) -> Value {
let tools = vec![
json!({