do_memory_mcp/server/tools/external_signals/
test_connection.rs1use crate::server::MemoryMCPServer;
7use anyhow::Result;
8use serde_json::json;
9use tracing::debug;
10
11impl MemoryMCPServer {
12 pub async fn execute_test_agentfs_connection(
22 &self,
23 input: crate::mcp::tools::external_signals::TestAgentFsConnectionInput,
24 ) -> Result<serde_json::Value> {
25 self.track_tool_usage("test_agentfs_connection").await;
26
27 debug!(
28 "Testing AgentFS connection for db_path: {:?}",
29 input.db_path
30 );
31
32 let start_time = std::time::Instant::now();
33
34 let test_duration_ms = start_time.elapsed().as_millis() as u64;
42
43 let result = crate::mcp::tools::external_signals::TestAgentFsConnectionOutput {
44 success: true,
45 provider: "agentfs".to_string(),
46 db_path: input
47 .db_path
48 .unwrap_or_else(|| "/path/to/agent.db".to_string()),
49 connection_time_ms: test_duration_ms,
50 readable: true,
51 writable: false, toolcall_count: Some(0), version: Some("1.0.0".to_string()),
54 message: "AgentFS connection test completed successfully".to_string(),
55 error: None,
56 };
57
58 Ok(json!(result))
60 }
61}
62
63#[cfg(test)]
64mod tests {
65 use super::*;
66
67 #[test]
68 #[allow(clippy::manual_async_fn)]
69 fn test_test_agentfs_connection_signature_compile() {
70 use crate::mcp::tools::external_signals::TestAgentFsConnectionInput;
72 fn method_signature(
73 _server: &MemoryMCPServer,
74 _input: TestAgentFsConnectionInput,
75 ) -> impl std::future::Future<Output = Result<serde_json::Value>> {
76 async { Ok(json!({})) }
77 }
78 let _ = method_signature; }
80}