search_catalog_items
Search for items in the Turbify Store catalog by matching keywords against ID, name, or code fields. Use this tool to find specific catalog items with basic search parameters.
Instructions
Search for items in the Turbify Store catalog.
Note: This simple search only matches the keyword against item ID, name, or code fields.
For more advanced search capabilities against other fields, use advanced_search_catalog_items.
Args:
keyword: Search keyword (matches against ID, name, or code fields only)
start_index: Starting index for pagination (default: 1)
end_index: Ending index for pagination (default: 100, max: 1000)
Returns:
JSON string with search results
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| keyword | Yes | ||
| start_index | No | ||
| end_index | No |
Implementation Reference
- The handler function for the 'search_catalog_items' tool. It uses TurbifyStoreAPIClient.simple_search to query the catalog by keyword within a paginated range and returns a JSON-formatted response with item IDs or errors.@mcp.tool() def search_catalog_items( keyword: str, start_index: int = 1, end_index: int = 100 ) -> str: """ Search for items in the Turbify Store catalog. Note: This simple search only matches the keyword against item ID, name, or code fields. For more advanced search capabilities against other fields, use advanced_search_catalog_items. Args: keyword: Search keyword (matches against ID, name, or code fields only) start_index: Starting index for pagination (default: 1) end_index: Ending index for pagination (default: 100, max: 1000) Returns: JSON string with search results """ if end_index > 1000: end_index = 1000 try: response = client.simple_search(keyword, start_index, end_index) # Extract item IDs from the response item_ids = response.item_ids if response.item_ids else [] return json.dumps({ "status": response.status, "success": response.is_success, "messages": response.success_messages, "errors": response.error_messages, "keyword": keyword, "start_index": start_index, "end_index": end_index, "total_items": len(item_ids), "item_ids": item_ids }, indent=2) except APIError as e: return json.dumps({ "status": "error", "success": False, "errors": [str(e)], "keyword": keyword }, indent=2)
- src/turbify_mcp/server.py:33-33 (registration)Top-level registration of catalog tools (including search_catalog_items) by calling register_catalog_tools on the MCP server instance in the setup_server function.register_catalog_tools(mcp)
- Type hints and docstring defining the input schema (parameters: keyword (str), start_index (int=1), end_index (int=100)) and output (str JSON).def search_catalog_items( keyword: str, start_index: int = 1, end_index: int = 100 ) -> str: """ Search for items in the Turbify Store catalog. Note: This simple search only matches the keyword against item ID, name, or code fields. For more advanced search capabilities against other fields, use advanced_search_catalog_items. Args: keyword: Search keyword (matches against ID, name, or code fields only) start_index: Starting index for pagination (default: 1) end_index: Ending index for pagination (default: 100, max: 1000) Returns: JSON string with search results """
- The registration helper function that defines and registers the search_catalog_items tool (and others) using @mcp.tool() decorators, sharing a TurbifyStoreAPIClient instance.def register_catalog_tools(mcp): """Register catalog management tools with the MCP server."""