pohoda_delete_stock
Remove inventory items from POHODA accounting software by specifying the item ID or stock code. This tool deletes stock records from the system.
Instructions
Delete a stock/inventory item from POHODA
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Stock item ID | |
| code | No | Stock code |
Implementation Reference
- src/tools/stock.ts:134-155 (handler)The `pohoda_delete_stock` tool handler, defined using `server.tool`, takes `id` or `code` as input, constructs an XML request with the `stk:delete` action, and processes the result.
server.tool( "pohoda_delete_stock", "Delete a stock/inventory item from POHODA", { id: z.number().optional().describe("Stock item ID"), code: z.string().optional().describe("Stock code") }, async (params) => { try { if (!params.id && !params.code) return err("Either id or code is required."); const xml = buildImportDoc({ ico: client.ico }, (item) => { const stk = item.ele(NS.stk, "stk:stock").att("version", "2.0"); const del = stk.ele(NS.stk, "stk:actionType").ele(NS.stk, "stk:delete"); const ftr = del.ele(NS.ftr, "ftr:filter"); if (params.id != null) ftr.ele(NS.ftr, "ftr:id").txt(String(params.id)); else if (params.code) ftr.ele(NS.ftr, "ftr:code").txt(params.code); }); const resp = parseResponse(await client.sendXml(xml)); const result = extractImportResult(resp); return result.success ? ok(`Stock item deleted. ${result.message}`) : err(`Failed: ${result.message}`); } catch (e) { return err((e as Error).message); } }, );