aether_core/events/
acp.rs1pub fn parse_tool_call_chunk(chunk: &str) -> serde_json::Value {
2 serde_json::from_str(chunk).unwrap_or_else(|_| serde_json::Value::String(chunk.to_string()))
3}
4
5pub fn mcp_tool_name(namespaced_name: &str) -> &str {
6 namespaced_name.split("__").last().unwrap_or(namespaced_name)
7}
8
9pub fn humanize_tool_name(name: &str) -> String {
10 let mut result = mcp_tool_name(name).replace('_', " ");
11 if let Some(first) = result.get_mut(0..1) {
12 first.make_ascii_uppercase();
13 }
14 result
15}
16
17#[cfg(test)]
18mod tests {
19 use super::*;
20
21 #[test]
22 fn humanizes_tool_names() {
23 assert_eq!(humanize_tool_name("coding__read_file"), "Read file");
24 assert_eq!(humanize_tool_name("read_file"), "Read file");
25 assert_eq!(humanize_tool_name("bash"), "Bash");
26 assert_eq!(humanize_tool_name("plugins__coding__read_file"), "Read file");
27 }
28
29 #[test]
30 fn strips_server_prefixes_from_tool_names() {
31 assert_eq!(mcp_tool_name("subagents__spawn_subagent"), "spawn_subagent");
32 assert_eq!(mcp_tool_name("plugins__coding__read_file"), "read_file");
33 assert_eq!(mcp_tool_name("bash"), "bash");
34 }
35}