get_catalog_items
Retrieve detailed information for multiple catalog items by specifying their IDs through the Turbify Store Catalog API.
Instructions
Get details for multiple catalog items.
Args:
item_ids: List of item IDs to retrieve
Returns:
JSON string with item details
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| item_ids | Yes |
Implementation Reference
- The main execution logic for the 'get_catalog_items' tool. It fetches item details using the TurbifyStoreAPIClient, serializes the response, and returns a JSON string.@mcp.tool() def get_catalog_items(item_ids: List[str]) -> str: """ Get details for multiple catalog items. Args: item_ids: List of item IDs to retrieve Returns: JSON string with item details """ try: response = client.get_item_details(item_ids) # Convert items to dictionaries if they're not already items = response.items if response.items else [] serializable_items = [] for item in items: if item and not isinstance(item, dict): # If it's a Pydantic model, convert to dict if hasattr(item, 'dict'): serializable_items.append(item.dict()) # If it's a dataclass, convert to dict elif hasattr(item, '__dict__'): serializable_items.append(item.__dict__) # Otherwise, try to serialize as is else: serializable_items.append(dict(item)) else: serializable_items.append(item) return json.dumps({ "status": response.status, "success": response.is_success, "messages": response.success_messages, "errors": response.error_messages, "item_count": len(serializable_items), "items": serializable_items }, indent=2) except APIError as e: return json.dumps({ "status": "error", "success": False, "errors": [str(e)], "item_ids": item_ids }, indent=2)
- src/turbify_mcp/server.py:33-33 (registration)The call to register_catalog_tools(mcp) which defines and registers the get_catalog_items tool using the @mcp.tool() decorator.register_catalog_tools(mcp)
- src/turbify_mcp/tools/catalog_tools.py:15-20 (registration)The registration function that sets up the API client and defines the tool functions with @mcp.tool() decorators, including get_catalog_items.def register_catalog_tools(mcp): """Register catalog management tools with the MCP server.""" # Initialize client (will be reused across tool calls) client = TurbifyStoreAPIClient()