Skip to main content

standard_free_string

Function standard_free_string 

Source
pub unsafe extern "C" fn standard_free_string(
    ptr: *mut u8,
    len: usize,
)
Expand description

Standard free_string implementation

Safely deallocates a buffer previously returned by return_success, return_error, or return_prebuilt. All of these guarantee len == capacity (via into_boxed_slice()), so the second parameter serves as both.

§Safety

ptr and len must exactly match values previously written to result_buf / result_len by this crate’s return helpers.

§Example

declare_plugin! {
    list_tools: generated_list_tools,
    execute_tool: generated_execute_tool,
    free_string: mcp_plugin_api::utils::standard_free_string
}