formlab-mcp 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2 -2
- package/package.json +1 -1
- package/server.json +2 -2
- package/tools/lab.js +2 -0
- package/vendor/equipment-calibration.js +9 -3
package/index.js
CHANGED
|
@@ -149,11 +149,11 @@ const PKG_VERSION = (() => {
|
|
|
149
149
|
const INSTRUCTIONS = `Times ending in "Z" (createdAt, updatedAt, holdAt, releasedAt, issuedAt, shipment dates…) are UTC. This lab's time zone is ${LOCAL_TZ}: when you give a date or time from one, convert it to ${LOCAL_TZ} first (late evening there can already be the next day in UTC). Plain dates with no time (testDate, preparedDate, expiryDate, best-by) are calendar days as entered: give them as they are. Day fields the server works out (asOf, a report's day when it has no test date, a supplier's lastReceived) are already ${LOCAL_TZ} days.
|
|
150
150
|
|
|
151
151
|
FormLab's QC definitions (answer by these; never infer them):
|
|
152
|
-
- In doubt (a reading): its instrument failed or was found out of tolerance at a calibration, and the reading falls between the last good calibration before it (with none on record, one calibration interval back, 12 months if no interval is set) and the repair's pass (or today while it still fails), or it was saved while the instrument was Out of service. Later calibrations do not clear it; a retest replaces the reading, or someone closes the instrument's review with a reason. The value and pass/fail stand. Tools: list_test_results in_doubt, get_test_result inDoubt, get_equipment doubtWindows.
|
|
152
|
+
- In doubt (a reading): its instrument failed or was found out of tolerance at a calibration, and the reading falls between the last good calibration before it (with none on record, one calibration interval back, 12 months if no interval is set) and the repair's pass (or today while it still fails; on that day, reports entered after the calibration are not in doubt), or it was saved while the instrument was Out of service. Later calibrations do not clear it; a retest replaces the reading, or someone closes the instrument's review with a reason. The value and pass/fail stand. Tools: list_test_results in_doubt, get_test_result inDoubt, get_equipment doubtWindows.
|
|
153
153
|
- Retest: repeats only a report's out-of-spec and in-doubt readings, linked (retestOf); it replaces them in rollups and on the CoA.
|
|
154
154
|
- Same-day readings: one point per test date; a day's readings average only under one spec; when two panels judged the same parameter that day, the later report stands.
|
|
155
155
|
- Holds: a held batch cannot ship until released (the Dashboard counts held batches with stock left); a lot on hold has status "hold" (incoming QC puts a received lot on hold until its QC releases it; FormLab does not set "quarantine" or "rejected" today, so a lot awaiting QC is on hold, not quarantined).
|
|
156
|
-
- Certificate of Analysis: latest result per parameter against its spec; required results come from the formula's releasePanel when set, else every panel used. Hard blocks: on hold, not made, no results. Out of spec ("Does not conform") and missing required results ("Not tested") can be issued with an override and a reason; a reading in doubt is only a warning.`;
|
|
156
|
+
- Certificate of Analysis: latest result per parameter against its spec; required results come from the formula's releasePanel when set, else every panel used. Hard blocks: on hold, not made, no results. Out of spec ("Does not conform") and missing required results ("Not tested") can be issued with an override and a reason; a reading in doubt is only a warning. A shipment recorded with QC open keeps the open items and the reason given (get_batch stockLedger: shippedWithQcOpen, qcReason).`;
|
|
157
157
|
const server = new Server(
|
|
158
158
|
{ name: 'formlab-mcp', version: PKG_VERSION },
|
|
159
159
|
{ capabilities: { tools: {} }, instructions: INSTRUCTIONS }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "formlab-mcp",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"mcpName": "io.github.juliu1980/formlab-mcp",
|
|
5
5
|
"description": "Read-only Model Context Protocol server for FormLab. Lets Claude and other MCP clients read and analyze your FormLab data, from a local export file or your live cloud workspace.",
|
|
6
6
|
"homepage": "https://formvix.com/mcp",
|
package/server.json
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
3
|
"name": "io.github.juliu1980/formlab-mcp",
|
|
4
4
|
"description": "Read-only MCP server for FormLab formulation data: a local export file or your live cloud workspace.",
|
|
5
|
-
"version": "0.7.
|
|
5
|
+
"version": "0.7.2",
|
|
6
6
|
"websiteUrl": "https://formvix.com/mcp",
|
|
7
7
|
"packages": [
|
|
8
8
|
{
|
|
9
9
|
"registryType": "npm",
|
|
10
10
|
"identifier": "formlab-mcp",
|
|
11
|
-
"version": "0.7.
|
|
11
|
+
"version": "0.7.2",
|
|
12
12
|
"runtimeHint": "npx",
|
|
13
13
|
"transport": {
|
|
14
14
|
"type": "stdio"
|
package/tools/lab.js
CHANGED
|
@@ -440,6 +440,8 @@ const get_batch = {
|
|
|
440
440
|
// parentBatchId === this id (see list_batches).
|
|
441
441
|
stockLedger: (Array.isArray(b.stockLedger) ? b.stockLedger : []).map(e => ({
|
|
442
442
|
date: e.ts || null, delta: e.delta ?? null, unit: e.unit || b.unit || '', kind: e.kind || '', note: e.note || '',
|
|
443
|
+
...(e.customer ? { customer: e.customer } : {}),
|
|
444
|
+
...(Array.isArray(e.qcOpen) && e.qcOpen.length ? { shippedWithQcOpen: e.qcOpen, qcReason: e.qcReason || null } : {}),
|
|
443
445
|
})),
|
|
444
446
|
shippedQty: (Array.isArray(b.stockLedger) ? b.stockLedger : []).reduce((s, e) => e.kind === 'shipment' ? s + Math.abs(parseFloat(e.delta) || 0) : s, 0),
|
|
445
447
|
// Finished-batch hold: while set, the app records no shipment of this batch (QA / complaint / recall).
|
|
@@ -178,13 +178,19 @@ function eqCalWindows(e, todayIso) {
|
|
|
178
178
|
lookBack = eqCalInterval(e) || EQ_CAL_LOOKBACK_MONTHS; lookBackDefault = !eqCalInterval(e);
|
|
179
179
|
since = _eqCalSubMonths(bad.date, lookBack);
|
|
180
180
|
}
|
|
181
|
-
|
|
181
|
+
// untilAt: when the calibration that ends the window was entered (the adjustment itself, or the repair's pass).
|
|
182
|
+
// On that day, a report entered after it was taken on the corrected instrument (Jun, 1 Dec: RV-2's "Reference
|
|
183
|
+
// check, after calibration" read In doubt because the window took the whole day).
|
|
184
|
+
const ender = kind === 'adjusted' ? bad : (fixed && fixed.date === until ? fixed : null);
|
|
185
|
+
const untilAt = (ender && ender.loggedAt) || '';
|
|
186
|
+
out.push({ calId: bad.id || '', kind, at: bad.date || '', since, lookBack, lookBackDefault, until, untilAt, fixedAt: kind === 'fail' && fixed ? (fixed.date || '') : '', review: bad.id ? eqCalReviewOf(e, bad.id) : null });
|
|
182
187
|
});
|
|
183
188
|
return out;
|
|
184
189
|
}
|
|
185
190
|
function _eqCalWindowTests(w, tests) {
|
|
186
191
|
const day = (t) => String((t && t.testDate) || '').split('T')[0];
|
|
187
|
-
|
|
192
|
+
const after = (t) => !!(w.untilAt && t && t.createdAt && String(t.createdAt) > String(w.untilAt));
|
|
193
|
+
return (tests || []).filter(t => { const d = day(t); return d && (!w.since || d > w.since) && (!w.until || d < w.until || (d === w.until && !after(t))); })
|
|
188
194
|
.sort((a, b) => day(a).localeCompare(day(b)));
|
|
189
195
|
}
|
|
190
196
|
// The latest window still open (its review not closed), with its reports and batches; null when none is open.
|
|
@@ -200,7 +206,7 @@ function eqCalSuspect(e, tests, todayIso) {
|
|
|
200
206
|
const b = sm && sm.batchId ? (db.batches || []).find(x => x && x.id === sm.batchId && !x._trashed) : null;
|
|
201
207
|
if (b && !batches.includes(b)) batches.push(b);
|
|
202
208
|
});
|
|
203
|
-
return { calId: w.calId, kind: w.kind, at: w.at, since: w.since, lookBack: w.lookBack, lookBackDefault: w.lookBackDefault, until: w.until, fixedAt: w.fixedAt, tests: hit, batches, open: open.length };
|
|
209
|
+
return { calId: w.calId, kind: w.kind, at: w.at, since: w.since, lookBack: w.lookBack, lookBackDefault: w.lookBackDefault, until: w.until, untilAt: w.untilAt, fixedAt: w.fixedAt, tests: hit, batches, open: open.length };
|
|
204
210
|
}
|
|
205
211
|
|
|
206
212
|
// ---- Readings in doubt (Jun, 30 Nov: "Flag doubtful readings"; shared with the MCP server) ----
|