Skip to content

feat: Allow loading default toolset (all tools) #153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/toolbox-core/src/toolbox_core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ async def load_tool(

async def load_toolset(
self,
name: str,
name: Optional[str] = None,
auth_token_getters: dict[str, Callable[[], str]] = {},
bound_params: Mapping[str, Union[Callable[[], Any], Any]] = {},
) -> list[ToolboxTool]:
Expand All @@ -192,7 +192,7 @@ async def load_toolset(
in the toolset.
"""
# Request the definition of the tool from the server
url = f"{self.__base_url}/api/toolset/{name}"
url = f"{self.__base_url}/api/toolset/{name or ''}"
async with self.__session.get(url) as response:
json = await response.json()
manifest: ManifestSchema = ManifestSchema(**json)
Expand Down
14 changes: 14 additions & 0 deletions packages/toolbox-core/tests/test_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,20 @@ async def test_load_toolset_specific(
tool_names = {tool.__name__ for tool in toolset}
assert tool_names == set(expected_tools)

async def test_load_toolset_default(self, toolbox: ToolboxClient):
"""Load the default toolset, i.e. all tools."""
toolset = await toolbox.load_toolset()
assert len(toolset) == 5
tool_names = {tool.__name__ for tool in toolset}
expected_tools = [
"get-row-by-content-auth",
"get-row-by-email-auth",
"get-row-by-id-auth",
"get-row-by-id",
"get-n-rows",
]
assert tool_names == set(expected_tools)

async def test_run_tool(self, get_n_rows_tool: ToolboxTool):
"""Invoke a tool."""
response = await get_n_rows_tool(num_rows="2")
Expand Down