get_vouchers_batches
Calls GET /api/vouchers/batches as the signed-in person · REST reference
Inventory batches, org-scoped unless the caller is platform staff
Backs the Vouchers page's Inventory tab. Declared before /{id} so the literal path is not captured as a voucher id. Answers the { data, count } envelope, unlike its sibling GET /api/vouchers which answers a bare array. Scoping is derived from the caller's own token, never from a query parameter: platform staff see every org's batches, and everyone else the batches of every organization in which they hold an inventory feature, bounded at the DAL. A caller holding an inventory feature in no organization is refused 403 before any DAL call. An unknown status is refused 400 before any DAL call; every failure of the read itself is answered 503 with a fixed message.
Arguments
| Argument | Type | Description | |
|---|---|---|---|
statusquery | "AVAILABLE" | "CREATED" | "DENIED" | "DEPLETED" | "DISTRIBUTED" | "EXPIRED" | … (12 values) | One of the DAL's inventory-batch statuses. Any other value is refused 400, naming the accepted ones, and nothing is read. | |
itemTypequery | string | ||
limitquery | integer | Applied only when it parses to a finite integer greater than zero; anything else is dropped and the DAL's own default page size applies. |
Example call
A client sends this over the MCP session; Claude and other agents build it for you. The values are placeholders — the shape is real.
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_vouchers_batches",
"arguments": {}
}
}Result
On success (HTTP 200) the tool returns one text item holding the API's JSON, pretty-printed.
The batches of every organization in which the caller holds an inventory feature (hospital.inventory.manage, distributor.inventory.manage or hospital.vouchers.request) — bounded at the DAL from the caller's own token — or every organization's for platform staff.
{
"count": 1,
"data": [
{
"availableQuantity": 1,
"batchNumber": "string",
"committedQuantity": 1,
"deleted": true,
"id": "string",
"inspectionDate": 1,
"itemName": "string",
"itemType": "string",
"manufactureDate": 1,
"quantity": 1,
"receivedDate": 1,
"reservedQuantity": 1,
"status": "AVAILABLE",
"totalPotentialValueCents": 1
}
]
}Fields
| Field | Type | Description |
|---|---|---|
count | integer | The DAL's totalCount for the filter, falling back to the length of data. It is therefore a MATCH count, not a page count, and normally exceeds data.length when a limit is applied. |
data | array of object | |
data[].assignedTo | string | null | |
data[].availableQuantity | number | |
data[].batchNumber | string | |
data[].batchType | string | null | |
data[].certifications | object | null | |
data[].committedQuantity | number | |
data[].complianceFlags | object | null | |
data[].createdBy | string | null | |
data[].deleted | boolean | |
data[].deletedAt | number | null | |
data[].deletedBy | string | null | |
data[].distributionCap | number | null | |
data[].distributionHistory | object | null | |
data[].expirationDate | number | null | |
data[].id | string | |
data[].inspectionDate | number | |
data[].inspectionResults | object | null | |
data[].itemDescription | string | null | |
data[].itemName | string | |
data[].itemType | string | |
data[].location | string | null | |
data[].lotNumber | string | null | |
data[].manufactureDate | number | |
data[].metadata | object | null | |
data[].printerJobId | string | null | |
data[].processedAt | number | null | |
data[].qualityGrade | string | null | |
data[].quantity | number | |
data[].receivedAt | number | null | |
data[].receivedDate | number | |
data[].reservedQuantity | number | |
data[].shippedAt | number | null | |
data[].shippingInfo | object | null | |
data[].status | "AVAILABLE" | "CREATED" | "DENIED" | "DEPLETED" | "DISTRIBUTED" | "EXPIRED" | … (12 values) | |
data[].storageConditions | string | null | |
data[].supplier | string | null | |
data[].supplierOrderNumber | string | null | |
data[].totalPotentialValueCents | integer | null | quantity × unitCostCents, in integer CENTS. Null on the same batches as unitCostCents. |
data[].type | string | null | |
data[].unitCostCents | integer | null | Cost of one unit in integer CENTS. Null on a batch whose cost the graph holds only in dollars. |
data[].unitOfMeasure | string | |
data[].updatedAt | number | null | |
data[].voucherCounts | object | The batch's vouchers by lifecycle state, counted in the graph. live (every state but VOIDED, EXPIRED and VOIDED_REPRINTED) against quantity is whether the batch still holds what its holder was promised; unissued (CREATED/ASSIGNED) is what a shrink may release. |
data[].voucherCounts.expired | integer | |
data[].voucherCounts.issued | integer | ISSUED through QUEUED_FOR_CHECKOUT. |
data[].voucherCounts.live | integer | |
data[].voucherCounts.paid | integer | |
data[].voucherCounts.reprinted | integer | VOIDED_REPRINTED — each replaced by a voucher counted in live. |
data[].voucherCounts.unissued | integer | |
data[].voucherCounts.voided | integer |
When it fails
A failed call returns isError: true with the API's message as text.
400The request was malformed or failed a guard.
403The caller holds no inventory feature in any organization.
What the model is shown
This is the tool exactly as the server lists it in tools/list. The description starts with the REST call it makes.
{
"name": "get_vouchers_batches",
"description": "GET /api/vouchers/batches — Backs the Vouchers page's Inventory tab. Declared before `/{id}` so the literal path is not captured as a voucher id. Answers the `{ data, count }` envelope, unlike its sibling `GET /api/vouchers` which answers a bare array. Scoping is derived from the caller's own token, never from a query parameter: platform staff see every org's batches, and everyone else the batches of every organization in which they hold an inventory feature, bounded at the DAL. A caller holding an inventory feature in no organization is refused 403 before any DAL call. An unknown `status` is refused 400 before any DAL call; every failure of the read itself is answered 503 with a fixed message.",
"inputSchema": {
"type": "object",
"properties": {
"status": {
"type": "string",
"description": "One of the DAL's inventory-batch statuses. Any other value is refused 400, naming the accepted ones, and nothing is read."
},
"itemType": {
"type": "string"
},
"limit": {
"type": "string",
"description": "Applied only when it parses to a finite integer greater than zero; anything else is dropped and the DAL's own default page size applies."
}
}
},
"annotations": {
"readOnlyHint": true,
"openWorldHint": false
}
}