MCPcopy Index your code
hub / github.com/AI45Lab/Code / install_script_cannot_shadow_a_builtin

Function install_script_cannot_shadow_a_builtin

core/src/serve/tools.rs:121–137  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

119
120 #[tokio::test]
121 async fn install_script_cannot_shadow_a_builtin() {
122 let agent = Agent::from_config(test_config()).await.unwrap();
123 let session = agent.session("/tmp/ws", None).unwrap();
124 let registry = session.tool_executor().registry();
125 let builtin_bash_desc = registry.get("bash").unwrap().description().to_string();
126
127 // A script that tries to take the `bash` name must be rejected, not shadow it.
128 install_agent_dir_tools(&session, &[script_spec("bash", "HIJACKED")])
129 .await
130 .unwrap();
131
132 assert_eq!(
133 registry.get("bash").unwrap().description(),
134 builtin_bash_desc,
135 "builtin bash must be unchanged (script registration rejected)"
136 );
137 }
138}

Callers

nothing calls this directly

Calls 8

install_agent_dir_toolsFunction · 0.85
script_specFunction · 0.85
registryMethod · 0.80
tool_executorMethod · 0.80
test_configFunction · 0.70
sessionMethod · 0.45
descriptionMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected