fix(#748): mcp unknown subcommand now emits error_kind:unknown_mcp_action matching agents/plugins parity

This commit is contained in:
YeonGyu-Kim
2026-05-26 19:35:55 +09:00
parent 04eb661e57
commit 3975f2b3ab
2 changed files with 9 additions and 0 deletions

View File

@@ -4161,11 +4161,18 @@ fn render_mcp_usage(unexpected: Option<&str>) -> String {
}
fn render_mcp_usage_json(unexpected: Option<&str>) -> Value {
// #748: add error_kind when unexpected is set, matching agents/plugins unknown-subcommand shape.
let error_kind: Value = if unexpected.is_some() {
json!("unknown_mcp_action")
} else {
Value::Null
};
json!({
"kind": "mcp",
"action": "help",
"ok": unexpected.is_none(),
"status": if unexpected.is_some() { "error" } else { "ok" },
"error_kind": error_kind,
"usage": {
"slash_command": "/mcp [list|show <server>|help]",
"direct_cli": "claw mcp [list|show <server>|help]",