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

Function extract_key_params

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

Extract a key parameter summary from JSON params

(params: &serde_json::Value)

Source from the content-addressed store, hash-verified

2031
2032/// Extract a key parameter summary from JSON params
2033fn extract_key_params(params: &serde_json::Value) -> String {
2034 if let Some(obj) = params.as_object() {
2035 let priority_keys = [
2036 "path",
2037 "file_path",
2038 "target_file",
2039 "query",
2040 "pattern",
2041 "command",
2042 "message",
2043 "url",
2044 ];
2045
2046 for key in &priority_keys {
2047 if let Some(value) = obj.get(*key) {
2048 if let Some(s) = value.as_str() {
2049 return truncate_str(s, 60);
2050 }
2051 }
2052 }
2053
2054 for (_key, value) in obj.iter() {
2055 if let Some(s) = value.as_str() {
2056 if s.len() < 100 {
2057 return truncate_str(s, 60);
2058 }
2059 }
2060 }
2061 }
2062
2063 String::new()
2064}
2065
2066/// Capitalize the first letter of a string
2067fn capitalize_first(s: &str) -> String {

Callers 2

inline_complete_textFunction · 0.85
render_generic_blockFunction · 0.85

Calls 5

truncate_strFunction · 0.85
iterMethod · 0.80
getMethod · 0.45
as_strMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected