Skip to main content

standard_free_string

Function standard_free_string 

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

Standard free_string implementation

This can be used directly in the declare_plugin! macro. It safely deallocates memory that was allocated by the plugin and passed to the framework.

§Safety

The pointer and capacity must match the values returned by return_success or return_error.

§Example

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