create_org_product
Create a new product in your organization's catalog by specifying name, and optionally SKU, price, category, image, stock status, and description.
Instructions
Create a new product in your organization's catalog.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Product name (required) | |
| sku | No | Optional SKU / part number | |
| price | No | Optional price (numeric) | |
| currency | No | ISO currency code (default TRY) | TRY |
| category | No | Optional category slug | |
| image_url | No | Optional product image URL (hosted image) | |
| stock_status | No | in_stock | out_of_stock | preorder | in_stock |
| description | No | Optional long description | |
| org_id | No | Optional — override the org bound to the API key |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/yaparai/tools/enterprise.py:123-166 (handler)The core handler function for the 'create_org_product' tool. Accepts product fields (name, sku, price, currency, category, image_url, stock_status, description, org_id), validates name, builds a payload dict, and delegates to the YaparAIClient.
async def create_org_product( name: str, sku: str | None = None, price: float | None = None, currency: str = "TRY", category: str | None = None, image_url: str | None = None, stock_status: Literal["in_stock", "out_of_stock", "preorder"] = "in_stock", description: str | None = None, org_id: str | None = None, ) -> dict: """ Create a new product in your organization's catalog. Args: name: Product name (required) sku: Optional SKU / part number price: Optional price (numeric) currency: ISO currency code (default TRY) category: Optional category slug image_url: Optional product image URL (hosted image) stock_status: in_stock | out_of_stock | preorder description: Optional long description org_id: Optional — override the org bound to the API key Returns: Created product record (with generated id + created_at). """ if not name or not name.strip(): raise ValueError("name is required") payload: dict = {"name": name.strip(), "currency": currency, "stock_status": stock_status} if sku: payload["sku"] = sku if price is not None: payload["price"] = price if category: payload["category"] = category if image_url: payload["image_url"] = image_url if description: payload["description"] = description client = YaparAIClient() return await client.enterprise_create_org_product(payload, org_id=org_id) - The function signature defines the input schema: name (required), sku, price, currency (default TRY), category, image_url, stock_status (literal enum with 'in_stock', 'out_of_stock', 'preorder'), description, and org_id.
async def create_org_product( name: str, sku: str | None = None, price: float | None = None, currency: str = "TRY", category: str | None = None, image_url: str | None = None, stock_status: Literal["in_stock", "out_of_stock", "preorder"] = "in_stock", description: str | None = None, org_id: str | None = None, ) -> dict: - src/yaparai/server.py:181-181 (registration)Registration of create_org_product as an MCP tool via mcp.tool(create_org_product) on line 181. Also imported on line 99 from yaparai.tools.enterprise.
mcp.tool(create_org_product) - src/yaparai/client.py:363-372 (helper)Client helper method that sends the actual HTTP POST request to /v1/public/enterprise/products with the payload and optional X-Organization-Id header.
async def enterprise_create_org_product( self, payload: dict, org_id: str | None = None ) -> dict: headers = {"X-Organization-Id": org_id} if org_id else {} return await self._request( "POST", "/v1/public/enterprise/products", json=payload, headers=headers, )