MCPcopy Create free account
hub / github.com/GCWing/BitFun / param_str

Function param_str

src/apps/cli/src/ui/tool_cards.rs:2013–2020  ·  view source on GitHub ↗

Extract a string parameter by trying multiple key names

(params: &serde_json::Value, keys: &[&str])

Source from the content-addressed store, hash-verified

2011
2012/// Extract a string parameter by trying multiple key names
2013fn param_str(params: &serde_json::Value, keys: &[&str]) -> String {
2014 for key in keys {
2015 if let Some(v) = params.get(*key).and_then(|v| v.as_str()) {
2016 return v.to_string();
2017 }
2018 }
2019 "unknown".to_string()
2020}
2021
2022/// Extract an optional string parameter
2023fn param_str_opt(params: &serde_json::Value, keys: &[&str]) -> Option<String> {

Callers 5

inline_complete_textFunction · 0.85
render_bash_blockFunction · 0.85
render_edit_blockFunction · 0.85
render_write_blockFunction · 0.85
render_delete_blockFunction · 0.85

Calls 2

getMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected