diff --git a/src/tools/draft-delivery-manifest.js b/src/tools/draft-delivery-manifest.js index 7a139ce..f7cf62e 100644 --- a/src/tools/draft-delivery-manifest.js +++ b/src/tools/draft-delivery-manifest.js @@ -1,14 +1,16 @@ import { defineTool } from 'libllmorbiter'; +import { TOOL_DESCRIPTIONS, TOOL_PARAMETER_DESCRIPTIONS } from './prompts.js'; /** * Creates the draft_delivery_manifest tool. * Stores extracted invoice/delivery-note data: header metadata (basedata), notes, and product line items. */ export function createDraftDeliveryManifestTool() { + const P = TOOL_PARAMETER_DESCRIPTIONS.draft_delivery_manifest; + return defineTool({ name: 'draft_delivery_manifest', - description: - 'Stores extracted invoice/delivery-note data: header metadata (basedata), notes, and product line items. Each component is strictly optional — only include the ones that carry new data.', + description: TOOL_DESCRIPTIONS.draft_delivery_manifest, strict: false, parameters: { type: 'object', @@ -21,29 +23,29 @@ export function createDraftDeliveryManifestTool() { type: 'object', additionalProperties: false, properties: { - date: { type: ['string', 'null'], description: 'Document date (ISO 8601)' }, - lieferant_id: { type: ['number', 'null'], description: 'Lieferant ID' }, - lieferantName: { type: 'string', description: 'Lieferant name' }, - manifestNr: { type: ['string', 'null'], description: 'Lieferscheinnummer or Rechnungsnummer' }, + date: { type: ['string', 'null'], description: P.date }, + lieferant_id: { type: ['number', 'null'], description: P.lieferant_id }, + lieferantName: { type: 'string', description: P.lieferantName }, + manifestNr: { type: ['string', 'null'], description: P.manifestNr }, manifestType: { anyOf: [ { type: 'string', enum: ['rechnung', 'lieferschein'] }, { type: 'null' }, ], - description: 'Document type', + description: P.manifestType, }, }, }, { type: 'null' }, ], - description: 'Header/metadata. Only include fields that are currently missing or changed.', + description: P.basedata, }, notes: { anyOf: [ { type: 'array', items: { type: 'string' } }, { type: 'null' }, ], - description: 'New noteworthy details (in German), for a human to double-check the result.', + description: P.notes, }, items: { anyOf: [ @@ -51,26 +53,25 @@ export function createDraftDeliveryManifestTool() { type: 'object', additionalProperties: false, properties: { - numberOfItemsToAdd: { type: 'number', description: 'Number of NEW line items being added in this call.' }, + numberOfItemsToAdd: { type: 'number', description: P.numberOfItemsToAdd }, items: { type: 'array', - description: 'Invoice/delivery product line items', + description: P.items_list, items: { type: 'object', additionalProperties: false, required: ['position', 'count', 'vpe', 'unit', 'articleName', 'liefArtNr', 'mwst', 'eknetto'], properties: { - position: { type: 'number', description: 'Position' }, - count: { type: 'number', description: 'Quantity (Menge)' }, - vpe: { type: 'number', description: 'Packaging unit size (VPE). Default: 1.' }, - unit: { type: 'string', description: 'Unit of the individual sellable item. NEVER "VE" or "VPE".' }, - articleName: { type: 'string', description: 'Article name' }, - liefArtNr: { type: 'string', description: 'Supplier article number' }, - mwst: { + position: { type: 'number', description: P.position }, + count: { type: 'number', description: P.count }, + vpe: { type: 'number', description: P.vpe }, + articleName: { type: 'string', description: P.articleName }, + liefArtNr: { type: 'string', description: P.liefArtNr }, + mwst: { // todo those needs to come from company settings. anyOf: [{ type: 'string', enum: ['7', '19'] }, { type: 'null' }], - description: 'VAT rate; null if missing', + description: P.mwst, }, - eknetto: { type: ['number', 'null'], description: 'Net price per vpe in euro cents; null if missing' }, + eknetto: { type: ['number', 'null'], description: P.eknetto }, }, }, }, @@ -78,7 +79,7 @@ export function createDraftDeliveryManifestTool() { }, { type: 'null' }, ], - description: 'New product line items.', + description: P.items, }, }, }, diff --git a/src/tools/prompts.js b/src/tools/prompts.js index a929d85..d3f9871 100644 --- a/src/tools/prompts.js +++ b/src/tools/prompts.js @@ -105,6 +105,9 @@ export const TOOL_DESCRIPTIONS = { 'Subagents can call all tools you can call except subagent, ask_user, and set_user_route. ' + 'To efficiently communicate with subagents, store the input and output data in VFS files ' + 'and provide these paths in the subagent instructions.', + + draft_delivery_manifest: + 'Stores extracted invoice/delivery-note data: header metadata (basedata), notes, and product line items. Each component is strictly optional — only include the ones that carry new data.', }; // #endregion @@ -258,6 +261,26 @@ export const TOOL_PARAMETER_DESCRIPTIONS = { conversation_id: 'Existing subagent conversation ID to follow up on, or null to create a new one.', max_iterations: 'Safety bound on tool loops (default 15, max 30).', }, + + draft_delivery_manifest: { + basedata: 'Header/metadata. Only include fields that are currently missing or changed.', + date: 'Document date (ISO 8601).', + lieferant_id: 'Lieferant ID.', + lieferantName: 'Lieferant name.', + manifestNr: 'Lieferscheinnummer or Rechnungsnummer.', + manifestType: 'Document type.', + notes: 'New noteworthy details (in German), for a human to double-check the result.', + items: 'New product line items.', + numberOfItemsToAdd: 'Number of NEW line items being added in this call.', + items_list: 'Invoice/delivery product line items.', + position: 'Position.', + count: 'Quantity (Menge).', + vpe: 'Packaging unit size (VPE). Default: 1.', + articleName: 'Article name.', + liefArtNr: 'Supplier article number.', + mwst: 'VAT rate; null if missing.', + eknetto: 'Net price per vpe in euro cents; null if missing.', + }, }; export const PATCH_PARAMETER_DESCRIPTIONS = TOOL_PARAMETER_DESCRIPTIONS.patch;