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

Function script_allowed_tools

core/src/tools/program_tool.rs:205–223  ·  view source on GitHub ↗
(args: &serde_json::Value, registry: &ToolRegistry)

Source from the content-addressed store, hash-verified

203}
204
205fn script_allowed_tools(args: &serde_json::Value, registry: &ToolRegistry) -> HashSet<String> {
206 let mut allowed = args
207 .get("allowed_tools")
208 .and_then(|value| value.as_array())
209 .map(|items| {
210 items
211 .iter()
212 .filter_map(|item| item.as_str())
213 .map(ToString::to_string)
214 .collect::<HashSet<_>>()
215 })
216 .unwrap_or_else(|| registry.list().into_iter().collect());
217
218 allowed.remove("program");
219 // `task`/`parallel_task` ARE allowed in PTC scripts now: host tool calls run
220 // on the outer multi-threaded runtime (see execute_host_tool_json), so
221 // `ctx.tool("parallel_task", …)` fans out child agents in parallel.
222 allowed
223}
224
225fn script_limits(args: &serde_json::Value) -> ScriptLimits {
226 args.get("limits")

Calls 4

removeMethod · 0.80
getMethod · 0.45
as_strMethod · 0.45
listMethod · 0.45