Skip to content

Commit fad2344

Browse files
authored
Merge pull request #188 from yjgoh28/fix-Tools-List-has-duplicate-category-names
fix: consolidate duplicate tool categories in list output
2 parents d0d47e4 + 1ab68dc commit fad2344

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

agentstack/cli/tools.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,19 @@ def list_tools():
1212
List all available tools by category.
1313
"""
1414
tools = get_all_tools()
15-
curr_category = None
16-
15+
categories = {}
16+
17+
# Group tools by category
18+
for tool in tools:
19+
if tool.category not in categories:
20+
categories[tool.category] = []
21+
categories[tool.category].append(tool)
22+
1723
print("\n\nAvailable AgentStack Tools:")
18-
for category, tools in itertools.groupby(tools, lambda x: x.category):
19-
if curr_category != category:
20-
print(f"\n{category}:")
21-
curr_category = category
22-
for tool in tools:
24+
# Display tools by category
25+
for category in sorted(categories.keys()):
26+
print(f"\n{category}:")
27+
for tool in categories[category]:
2328
print(" - ", end='')
2429
print(term_color(f"{tool.name}", 'blue'), end='')
2530
print(f": {tool.url if tool.url else 'AgentStack default tool'}")

0 commit comments

Comments
 (0)