Skip to content

Commit 755c69a

Browse files
CodeKeanuclaude
andcommitted
fix: add tags filter to search_workshop_collections
Brings search_workshop_collections to feature parity with search_workshop_items - both now support: - app_id (required) - search_query (text search) - tags (array of Workshop tags to filter by) - sort_by (popular/trend/recent/rating) - max_results 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 401ead8 commit 755c69a

2 files changed

Lines changed: 32 additions & 1 deletion

File tree

src/steam_mcp/endpoints/steam_workshop.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,12 @@ async def get_workshop_item_details(
425425
"description": "Text search filter (optional)",
426426
"required": False,
427427
},
428+
"tags": {
429+
"type": "array",
430+
"items": {"type": "string"},
431+
"description": "Filter by Workshop tags (e.g., 'Maps', 'Weapons', 'Characters')",
432+
"required": False,
433+
},
428434
"sort_by": {
429435
"type": "string",
430436
"description": "Sort order: 'popular' (most voted), 'trend' (trending), 'recent' (newest), 'rating' (highest rated)",
@@ -446,6 +452,7 @@ async def search_workshop_collections(
446452
self,
447453
app_id: int,
448454
search_query: str = "",
455+
tags: list[str] | None = None,
449456
sort_by: str = "popular",
450457
max_results: int = 10,
451458
format: str = "text",
@@ -467,6 +474,10 @@ async def search_workshop_collections(
467474
if search_query:
468475
params["search_text"] = search_query
469476

477+
if tags:
478+
for i, tag in enumerate(tags):
479+
params[f"requiredtags[{i}]"] = tag
480+
470481
try:
471482
result = await self.client.get(
472483
"IPublishedFileService",
@@ -488,7 +499,9 @@ async def search_workshop_collections(
488499
msg = f"No Workshop collections found for app {app_id}."
489500
if search_query:
490501
msg += f" Search query: '{search_query}'"
491-
msg += "\n\nThis game may not have Workshop collections, or no collections match your search."
502+
if tags:
503+
msg += f" Tags: {', '.join(tags)}"
504+
msg += "\n\nThis game may not have Workshop collections, or no collections match your filters."
492505
if format == "json":
493506
return json.dumps({"error": msg})
494507
return msg
@@ -531,6 +544,8 @@ async def search_workshop_collections(
531544

532545
if search_query:
533546
output.append(f"Search: '{search_query}'")
547+
if tags:
548+
output.append(f"Tags: {', '.join(tags)}")
534549
output.append("")
535550

536551
for coll in collections:

tests/test_steam_workshop.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,22 @@ async def test_search_collections_with_query(self, workshop_service, mock_client
244244
assert call_args[1]["params"]["search_text"] == "weapon skins"
245245
assert call_args[1]["params"]["filetype"] == 2 # Collections only
246246

247+
@pytest.mark.asyncio
248+
async def test_search_collections_with_tags(self, workshop_service, mock_client):
249+
"""Should pass tags to API."""
250+
mock_client.get.return_value = {
251+
"response": {"total": 0, "publishedfiledetails": []}
252+
}
253+
254+
await workshop_service.search_workshop_collections(
255+
app_id=730, tags=["Maps", "Competitive"]
256+
)
257+
258+
call_args = mock_client.get.call_args
259+
assert call_args[1]["params"]["requiredtags[0]"] == "Maps"
260+
assert call_args[1]["params"]["requiredtags[1]"] == "Competitive"
261+
assert call_args[1]["params"]["filetype"] == 2
262+
247263
@pytest.mark.asyncio
248264
async def test_search_collections_empty_results(self, workshop_service, mock_client):
249265
"""Should handle no results gracefully."""

0 commit comments

Comments
 (0)