feat: provide more context about exportable tools

This commit is contained in:
Lucas Gomide
2025-05-19 10:25:07 -03:00
parent f6399208fb
commit 6f73bd80f4
2 changed files with 9 additions and 6 deletions

View File

@@ -385,7 +385,7 @@ def extract_available_exports(dir_path: str = "src"):
raise SystemExit(1)
def _load_tools_from_init(init_file: Path) -> list:
def _load_tools_from_init(init_file: Path) -> list[dict[str, Any]]:
"""
Load and validate tools from a given __init__.py file.
"""
@@ -407,8 +407,11 @@ def _load_tools_from_init(init_file: Path) -> list:
raise SystemExit(1)
# TODO: Security check: prevent any inject malicious code, or stuff like that
return [
name
{
"name": name,
}
for name in module.__all__
if hasattr(module, name) and is_valid_tool(getattr(module, name))
]