pohoda_create_service
Create service records in POHODA accounting software by specifying date, description, partner name, and notes for maintenance tracking.
Instructions
Create a service record in POHODA
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | Yes | Service date | |
| text | No | Description | |
| partnerName | No | ||
| note | No |
Implementation Reference
- src/tools/production.ts:115-146 (handler)The `pohoda_create_service` tool is defined here using the `server.tool` method, with input validation via `zod` and the handler logic that constructs the XML import request using `buildImportDoc` and submits it via `client.sendXml`.
server.tool( "pohoda_create_service", "Create a service record in POHODA", { date: z.string().describe("Service date"), text: z.string().optional().describe("Description"), partnerName: z.string().optional(), note: z.string().optional(), }, async (params) => { try { const xml = buildImportDoc({ ico: client.ico }, (item) => { const doc = item.ele(NS.ser, "ser:service").att("version", "2.0"); const hdr = doc.ele(NS.ser, "ser:serviceHeader"); hdr.ele(NS.ser, "ser:date").txt(toIsoDate(params.date)); if (params.text) hdr.ele(NS.ser, "ser:text").txt(params.text); if (params.partnerName) { const pi = hdr.ele(NS.ser, "ser:partnerIdentity"); pi.ele(NS.typ, "typ:address").ele(NS.typ, "typ:name").txt(params.partnerName); } if (params.note) hdr.ele(NS.ser, "ser:note").txt(params.note); }); const resp = parseResponse(await client.sendXml(xml)); const result = extractImportResult(resp); return result.success ? ok(`Service record created. ${result.message}${result.producedId ? ` ID: ${result.producedId}` : ""}`) : err(`Failed: ${result.message}`); } catch (e) { return err((e as Error).message); } }, );