Skip to main content
Glama
benpeke

Turbify Store MCP Server

by benpeke

delete_items

Remove multiple catalog items simultaneously by specifying their IDs. This tool streamlines inventory management by allowing batch deletion operations.

Instructions

    Delete multiple items in a single operation.
    
    Args:
        item_ids: List of item IDs to delete
    
    Returns:
        JSON string with operation result
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
item_idsYes

Implementation Reference

  • The MCP tool handler for 'delete_items', decorated with @mcp.tool(). Calls the TurbifyStoreAPIClient to perform the deletion and returns a JSON-formatted response.
    @mcp.tool()
    def delete_items(item_ids: List[str]) -> str:
        """
        Delete multiple items in a single operation.
        
        Args:
            item_ids: List of item IDs to delete
        
        Returns:
            JSON string with operation result
        """
        try:
            response = client.delete_items(item_ids)
            
            return json.dumps({
                "status": response.status,
                "success": response.is_success,
                "messages": response.success_messages,
                "errors": response.error_messages,
                "items_processed": len(item_ids)
            }, indent=2)
            
        except APIError as e:
            return json.dumps({
                "status": "error",
                "success": False,
                "errors": [str(e)],
                "items_processed": 0
            }, indent=2)
  • Registration of catalog tools (including delete_items) by calling register_catalog_tools(mcp) in the main server setup.
    # Register all tools
    register_catalog_tools(mcp)
  • Helper method in TurbifyStoreAPIClient that constructs the XML delete request for the Catalog API and handles the response.
    def delete_items(self, item_ids: List[str]) -> APIResponse:
        """
        Delete multiple items in a single API call.
        """
        self.logger.debug(f"Batch delete: {len(item_ids)} items")
        if len(item_ids) > self.config.max_items_per_call:
            raise ValueError(f"Cannot delete more than {self.config.max_items_per_call} items at once")
    
        # Create ItemIDList
        item_idlist = ItemIdlistType(id=item_ids)
        catalog = CatalogType(item_idlist=item_idlist)
        resource_list = RequestResourceListType(catalog=catalog)
        
        # Create request
        request = self._create_base_request("delete")
        request.resource_list = resource_list
    
        response_dict = self._make_api_call("Catalog", request)
    
        # Return APIResponse with item IDs
        return APIResponse(
            status="success" if response_dict.get('success') else "error",
            item_ids=item_ids,
            errors=response_dict.get('errors', []),
            warnings=response_dict.get('warnings', []),
            messages=response_dict.get('info', [])
        )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/benpeke/turbify_store_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server