Skip to main content

Module utils

Module utils 

Source
Expand description

Memory management utilities for plugins

This module provides safe wrappers around the unsafe FFI memory management operations required by the plugin API.

All returned buffers use into_boxed_slice() to guarantee len == capacity, so standard_free_string(ptr, len) can safely reconstruct and drop a Vec.

Functions§

html_content
Helper to create an HTML content response
image_contentDeprecated
Helper to create an image content response (legacy)
image_data_content
Helper to create an image content response with base64 data
image_url_content
Helper to create an image content response with URL
json_content
Helper to create a JSON content response
markdown_content
Helper to create a Markdown content response
multi_content
Helper to create a multi-content response
prepare_result
Serialize a Value and hand the buffer to the framework.
resource_content
Helper to create a resource content response
resource_list_response
Build MCP resources/list response JSON
resource_read_response
Build MCP resources/read response JSON
resource_template_list_response
Build MCP resources/templates/list response JSON
return_error
Return an error result to the framework
return_prebuilt
Copy pre-serialized bytes into a fresh allocation and hand it to the framework.
return_success
Return a success result to the framework
standard_free_string
Standard free_string implementation
text_content
Helper to create a text content response