Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(tools): filter tools by group mode in registration and schema stripping

Steven Enamakel1a960ce8362e
diff --git a/src/openhuman/tools/ops.rs b/src/openhuman/tools/ops.rs
index 468c98cfdf..66de19b0cc 100644
--- a/src/openhuman/tools/ops.rs
+++ b/src/openhuman/tools/ops.rs
@@ -1262,10 +1262,24 @@ pub fn all_tools_with_runtime(
let after_domains = tools.len();
tools.retain(|t| crate::core::all::capability_allowed(tool_capability(t.name())));
+ let after_capabilities = tools.len();
+
+ // 3. ToolGroups: a group an embedder set to `Off` is not registered at all.
+ // `Advertised` and `Withheld` both keep the tool here — they differ only
+ // in whether its schema reaches the provider, which is decided later by
+ // `strip_packed_from_visible`. Same default-open rule as the two filters
+ // above: with no ambient context every group is `Withheld`, so nothing
+ // is dropped and the desktop list is unchanged.
+ {
+ let groups = crate::openhuman::tools::toolpacks::groups::current();
+ tools.retain(|t| {
+ groups.mode_for_tool(t.name()) != crate::openhuman::tools::toolpacks::GroupMode::Off
+ });
+ }
log::debug!(
- "[tools::ops][post-filter] {before} assembled → {after_domains} after DomainSet → {} after \
- memory capabilities",
+ "[tools::ops][post-filter] {before} assembled → {after_domains} after DomainSet → \
+ {after_capabilities} after memory capabilities → {} after ToolGroups",
tools.len()
);
diff --git a/src/openhuman/tools/toolpacks/ops.rs b/src/openhuman/tools/toolpacks/ops.rs
index 8233061e44..e8d6221f85 100644
--- a/src/openhuman/tools/toolpacks/ops.rs
+++ b/src/openhuman/tools/toolpacks/ops.rs
@@ -59,8 +59,14 @@ pub fn strip_packed_from_visible(visible: &mut HashSet<String>, agent_id: &str)
if visible.is_empty() {
return;
}
+ // Groups an embedder marked `Advertised` keep their schemas on the wire;
+ // `Off` groups were never registered, so nothing of theirs can be in
+ // `visible` to subtract. Only `Withheld` — the default for every group —
+ // is actually withheld here.
+ let groups = super::groups::current();
let packed: Vec<String> = registry::packed_tool_names_for_agent(agent_id)
.into_iter()
+ .filter(|name| groups.mode_for_tool(name) == super::groups::GroupMode::Withheld)
.filter(|name| visible.contains(*name))
.map(str::to_string)
.collect();