b24_products_create
Create a product in the catalog. Specify a required name and optionally set price, currency, description, active status, section, or preview picture.
Instructions
Crea un nuevo producto en el catálogo.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fields | Yes | Campos del producto. Requeridos: NAME. Opcionales: ACTIVE, PRICE, CURRENCY_ID, DESCRIPTION, SECTION_ID, PREVIEW_PICTURE | |
| webhook_url | No |
Implementation Reference
- src/tools/catalog-products.js:55-59 (handler)The actual handler function that creates a product in Bitrix24 catalog. It calls 'catalog.product.add' via the Bitrix24 client with the provided fields and returns the created product ID.
export async function productsCreate({ fields, webhook_url }) { const client = new Bitrix24Client(resolveWebhook(webhook_url)); const res = await client.call('catalog.product.add', { fields }); return { portal: client.portal, created_id: res.result, success: true }; } - src/tools/catalog-products.js:47-53 (schema)Zod schema for the 'b24_products_create' tool. Defines 'fields' (object of product fields, NAME required, optional: ACTIVE, PRICE, CURRENCY_ID, etc.) and optional 'webhook_url'.
export const productsCreateSchema = z.object({ fields: z.record(z.any()).describe( 'Campos del producto. Requeridos: NAME. ' + 'Opcionales: ACTIVE, PRICE, CURRENCY_ID, DESCRIPTION, SECTION_ID, PREVIEW_PICTURE' ), webhook_url: z.string().url().optional(), }); - index.js:271-273 (registration)Registers the tool 'b24_products_create' on the MCP server with its description, schema, and handler (via the wrap function).
server.tool('b24_products_create', 'Crea un nuevo producto en el catálogo.', productsCreateSchema.shape, wrap(productsCreate)); - index.js:65-72 (registration)Import statement that brings in productsCreateSchema and productsCreate from the catalog-products module.
// ── Catálogo / Productos ────────────────────────────────────────────────────── import { productsListSchema, productsList, productsGetSchema, productsGet, productsCreateSchema, productsCreate, productsUpdateSchema, productsUpdate, productsSectionsSchema, productsSections, } from './src/tools/catalog-products.js';