mirror of
https://github.com/instructkr/claude-code.git
synced 2026-05-30 17:26:44 +00:00
fix: mcp show (missing server name) emits missing_argument error_kind (#830)
`claw --output-format json mcp show` (no server name) previously emitted
error_kind:"unknown_mcp_action" — misleading because `show` IS a known
action; the problem is a missing required argument.
Fix:
- `render_mcp_report_json_for`: `Some("show")` arm now emits a dedicated
JSON response with error_kind:"missing_argument" + usage hint
- `classify_error_kind`: add classifier arm for "missing_argument:" prefix
One new test: mcp_show_missing_server_name_emits_missing_argument
572+ tests pass.
This commit is contained in:
@@ -3027,7 +3027,19 @@ fn render_mcp_report_json_for(
|
||||
}
|
||||
}
|
||||
Some(args) if is_help_arg(args) => Ok(render_mcp_usage_json(None)),
|
||||
Some("show") => Ok(render_mcp_usage_json(Some("show"))),
|
||||
// #830: `claw mcp show` with no server name is a missing required
|
||||
// argument, not an unknown action. Emit a dedicated error_kind so
|
||||
// machine consumers can distinguish "I know show, but need a name"
|
||||
// from "I don't know this action".
|
||||
Some("show") => Ok(serde_json::json!({
|
||||
"kind": "mcp",
|
||||
"action": "show",
|
||||
"status": "error",
|
||||
"ok": false,
|
||||
"error_kind": "missing_argument",
|
||||
"hint": "Usage: claw mcp show <server>\nRun `claw mcp list` to see available servers.",
|
||||
"message": "missing required argument: mcp show requires a server name.",
|
||||
})),
|
||||
Some(args) if args.split_whitespace().next() == Some("show") => {
|
||||
let mut parts = args.split_whitespace();
|
||||
let _ = parts.next();
|
||||
|
||||
Reference in New Issue
Block a user