mirror of
https://github.com/instructkr/claw-code.git
synced 2026-06-05 22:17:10 +08:00
fix: return typed error for unsupported MCP sub-actions
The catch-all in render_mcp_report_json_for now returns render_mcp_unsupported_action_json with ok:false and error_kind:unsupported_action instead of help JSON with exit 0. Generated with https://github.com/Yeachan-Heo/gajae-code Co-authored-by: Gajae Code <dev@gajae-code.com>
This commit is contained in:
@@ -3308,7 +3308,15 @@ fn render_mcp_report_json_for(
|
||||
"use `claw mcp show <server>` to inspect a server",
|
||||
))
|
||||
}
|
||||
Some(args) => Ok(render_mcp_usage_json(Some(args))),
|
||||
Some(args) => {
|
||||
// #681: unsupported mutation verbs (add, remove, delete, enable, disable)
|
||||
// and other unknown sub-actions return a typed error instead of help with exit 0.
|
||||
let verb = args.split_whitespace().next().unwrap_or(args);
|
||||
Ok(render_mcp_unsupported_action_json(
|
||||
args,
|
||||
&format!("`{verb}` is not a supported MCP sub-action; supported actions: list, show, help"),
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user