Skip to main content

extract_arg

Function extract_arg 

Source
pub fn extract_arg(arguments: &str, name: &str) -> Option<String>
Expand description

Extract a string argument from a tool/prompt arguments JSON object.

use rust_web_server::mcp::extract_arg;
assert_eq!(extract_arg(r#"{"text":"hello"}"#, "text").as_deref(), Some("hello"));
assert_eq!(extract_arg(r#"{}"#, "missing"), None);