Skip to content

Commit 0221729

Browse files
committed
env use wildcard tools
1 parent 850e3e2 commit 0221729

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

docs/docs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"icon": "code",
3434
"versions": [
3535
{
36-
"version": "0.5.8",
36+
"version": "0.5.9",
3737
"groups": [
3838
{
3939
"group": "Get Started",

hud/environment/environment.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,18 +189,25 @@ def as_tools(self) -> list[mcp_types.Tool]:
189189
"""Return tools in MCP format (base format).
190190
191191
Applies agent-level include/exclude filtering if set.
192+
Supports fnmatch-style wildcards (e.g., "*setup*", "browser_*").
192193
"""
194+
import fnmatch
195+
193196
tools = self._router.tools
194197

195198
# Apply agent-level filtering (from v4 allowed_tools/disallowed_tools)
196199
if self._agent_include is not None or self._agent_exclude is not None:
197200
filtered = []
198201
for tool in tools:
199-
# Include filter: None means include all
200-
if self._agent_include is not None and tool.name not in self._agent_include:
202+
# Include filter: None means include all, check if matches any pattern
203+
if self._agent_include is not None and not any(
204+
fnmatch.fnmatch(tool.name, pattern) for pattern in self._agent_include
205+
):
201206
continue
202-
# Exclude filter
203-
if self._agent_exclude is not None and tool.name in self._agent_exclude:
207+
# Exclude filter: skip if tool matches any exclude pattern
208+
if self._agent_exclude is not None and any(
209+
fnmatch.fnmatch(tool.name, pattern) for pattern in self._agent_exclude
210+
):
204211
continue
205212
filtered.append(tool)
206213
return filtered

hud/utils/tests/test_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ def test_import():
55
"""Test that the package can be imported."""
66
import hud
77

8-
assert hud.__version__ == "0.5.8"
8+
assert hud.__version__ == "0.5.9"

hud/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
from __future__ import annotations
66

7-
__version__ = "0.5.8"
7+
__version__ = "0.5.9"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "hud-python"
3-
version = "0.5.8"
3+
version = "0.5.9"
44
description = "SDK for the HUD platform."
55
readme = "README.md"
66
requires-python = ">=3.11, <3.13"

0 commit comments

Comments
 (0)