1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//! Port of ophis `tools_test.go::TestCustomCommandName`.
//!
//! Verifies that setting `Config.command_name` to a name other than `"mcp"`
//! changes the substring filter so that the user's own `mcp` service subtree
//! is NOT accidentally excluded from the generated tool list.
use clap::Command;
use brontes::Config;
#[test]
fn custom_command_name_does_not_filter_user_mcp_subtree() {
// ophis tools_test.go::TestCustomCommandName parity port.
//
// The user's `mcp` subtree must survive because the brontes filter
// uses Config.command_name ("agent") as the substring, not "mcp".
let root = Command::new("myapp")
.subcommand(
Command::new("mcp")
.about("MCP business service")
.subcommand(Command::new("install").about("Install the mcp service")),
)
.subcommand(Command::new("status").about("Show status"));
let cfg = Config::default().command_name("agent");
let tools = brontes::generate_tools(&root, &cfg).expect("generate_tools should succeed");
let names: Vec<&str> = tools.iter().map(|t| t.name.as_ref()).collect();
assert!(
names.contains(&"myapp_mcp_install"),
"user's mcp install should survive: got {names:?}"
);
assert!(
names.contains(&"myapp_status"),
"user's status should survive: got {names:?}"
);
// No "agent" tools — the brontes mcp subtree is not part of this release.
assert!(
!names.iter().any(|n| n.contains("agent")),
"no agent tool should leak: {names:?}"
);
}