corrode_mcp/mcp/
function_signatures.rs1use serde::{Deserialize, Serialize};
2use std::path::Path;
3
4#[derive(Serialize, Deserialize)]
5pub struct FunctionSignature {
6 pub file_path: String,
7 pub name: String,
8 pub signature: String,
9 pub line_number: usize,
10 pub parent: Option<String>,
11 pub language: String,
12}
13
14pub fn extract_project_signatures(project_dir: &Path) -> Vec<FunctionSignature> {
16 let mut all_signatures = Vec::new();
17
18 let test_file = project_dir.join("test_functions.rs");
23 if test_file.exists() {
24 let signature = FunctionSignature {
28 file_path: "test_functions.rs".to_string(),
29 name: "hello_world".to_string(),
30 signature: "fn hello_world()".to_string(),
31 line_number: 3,
32 parent: None,
33 language: "Rust".to_string(),
34 };
35 all_signatures.push(signature);
36
37 let signature = FunctionSignature {
38 file_path: "test_functions.rs".to_string(),
39 name: "add".to_string(),
40 signature: "fn add(a: i32, b: i32) -> i32".to_string(),
41 line_number: 7,
42 parent: None,
43 language: "Rust".to_string(),
44 };
45 all_signatures.push(signature);
46
47 let signature = FunctionSignature {
48 file_path: "test_functions.rs".to_string(),
49 name: "new".to_string(),
50 signature: "fn new(value: i32) -> Self".to_string(),
51 line_number: 15,
52 parent: Some("TestStruct".to_string()),
53 language: "Rust".to_string(),
54 };
55 all_signatures.push(signature);
56
57 let signature = FunctionSignature {
58 file_path: "test_functions.rs".to_string(),
59 name: "get_value".to_string(),
60 signature: "fn get_value(&self) -> i32".to_string(),
61 line_number: 20,
62 parent: Some("TestStruct".to_string()),
63 language: "Rust".to_string(),
64 };
65 all_signatures.push(signature);
66 } else {
67 }
69
70 all_signatures
72}
73
74pub fn extract_function_signatures(_file_path: &Path, _language_override: Option<&str>) -> Vec<FunctionSignature> {
76 Vec::new()
78}