aether_cli/acp/protocol/
commands.rs1use agent_client_protocol::schema as acp;
2use rmcp::model::Prompt as McpPrompt;
3
4pub fn map_mcp_prompt_to_available_command(prompt: &McpPrompt) -> acp::AvailableCommand {
9 let command_name = prompt.name.split("__").last().unwrap_or(prompt.name.as_ref()).to_string();
10
11 let hint = prompt
12 .arguments
13 .as_ref()
14 .and_then(|args| args.iter().find(|a| a.name.as_str() == "ARGUMENTS").and_then(|a| a.description.as_deref()))
15 .unwrap_or("optional arguments");
16
17 let input = Some(acp::AvailableCommandInput::Unstructured(acp::UnstructuredCommandInput::new(hint)));
18
19 let description = prompt.description.clone().unwrap_or_else(|| "No description available".to_string());
20
21 acp::AvailableCommand::new(command_name, description).input(input)
22}