22Get available tools from your StackOne organisation based on the account id.
33
44This example demonstrates different ways to filter and organize tools:
5+
561. Getting all available tools
672. Filtering by vertical
783. Using multiple patterns for cross-vertical functionality
2526def get_available_tools () -> None :
2627 toolset = StackOneToolSet ()
2728
28- # First, get all tools
29+ """
30+ We can get all tools using the `get_tools` method.
31+ """
2932 all_tools = toolset .get_tools ()
3033 assert len (all_tools ) > 100 , "Expected at least 100 tools in total"
3134
32- # Then, let's get just HRIS tools using a vertical filter
35+ """
36+ Then, let's get just HRIS tools using a filter. This filter accepts glob patterns.
37+ """
3338 hris_tools = toolset .get_tools ("hris_*" )
3439 assert len (hris_tools ) > 10 , "Expected at least 10 HRIS tools"
3540
36- # Now, let's get people-related tools across verticals
41+ """
42+ Filter with multiple patterns. This will return all tools that match either pattern (OR operator).
43+ """
3744 people_tools = toolset .get_tools (
3845 [
3946 "hris_*employee*" ,
@@ -46,19 +53,25 @@ def get_available_tools() -> None:
4653 f"Tool { tool .name } doesn't contain 'employee' or 'contact'"
4754 )
4855
49- # We can also filter by specific operations across all verticals
56+ """
57+ Filter by specific operations across all verticals using a glob pattern.
58+ """
5059 upload_tools = toolset .get_tools ("*upload*" )
5160 assert len (upload_tools ) > 0 , "Expected at least one upload tool"
5261 for tool in upload_tools :
5362 assert "upload" in tool .name .lower (), f"Tool { tool .name } doesn't contain 'upload'"
5463
55- # Get all tools except HRIS
64+ """
65+ The exclude pattern is also supported.
66+ """
5667 non_hris_tools = toolset .get_tools ("!hris_*" )
5768 assert len (non_hris_tools ) > 0 , "Expected at least one non-HRIS tool"
5869 for tool in non_hris_tools :
5970 assert not tool .name .startswith ("hris_" ), f"Tool { tool .name } should not be an HRIS tool"
6071
61- # Complex filtering with positive and negative patterns
72+ """
73+ More hectic example:
74+ """
6275 list_tools = toolset .get_tools (
6376 [
6477 "*list*" , # Include list operations
0 commit comments