Skip to content

Commit b3e09e3

Browse files
committed
fix(src): move get version function on C side
1 parent c67892d commit b3e09e3

File tree

4 files changed

+2
-25
lines changed

4 files changed

+2
-25
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mcp-ffi"
3-
version = "0.1.0"
3+
version = "0.1.4"
44
edition = "2021"
55

66
[dependencies]

src/lib.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,6 @@ pub extern "C" fn mcp_init() -> i32 {
4040
0
4141
}
4242

43-
/// Get the version string of the MCP library
44-
/// Returns a null-terminated string that must be freed with mcp_free_string
45-
#[no_mangle]
46-
pub extern "C" fn mcp_get_version() -> *mut c_char {
47-
let version = env!("CARGO_PKG_VERSION");
48-
match CString::new(version) {
49-
Ok(c_str) => c_str.into_raw(),
50-
Err(_) => ptr::null_mut(),
51-
}
52-
}
53-
5443
/// Free a string allocated by the MCP library
5544
#[no_mangle]
5645
pub extern "C" fn mcp_free_string(s: *mut c_char) {

src/mcp_ffi.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ typedef struct McpClient McpClient;
2323
*/
2424
int32_t mcp_init(void);
2525

26-
/**
27-
* Get the version string of the MCP library
28-
* Returns a null-terminated string that must be freed with mcp_free_string
29-
*/
30-
char* mcp_get_version(void);
31-
3226
/**
3327
* Free a string allocated by the MCP library
3428
*/

src/sqlite-mcp.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,7 @@ static void mcp_version_func(
3939
int argc,
4040
sqlite3_value **argv
4141
){
42-
char *version = mcp_get_version();
43-
if (version) {
44-
sqlite3_result_text(context, version, -1, SQLITE_TRANSIENT);
45-
mcp_free_string(version);
46-
} else {
47-
sqlite3_result_error(context, "Failed to get MCP version", -1);
48-
}
42+
sqlite3_result_text(context, SQLITE_MCP_VERSION, -1, NULL);
4943
}
5044

5145
/*

0 commit comments

Comments
 (0)