formlab-mcp 0.6.74 → 0.6.76

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "formlab-mcp",
3
- "version": "0.6.74",
3
+ "version": "0.6.76",
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.6.74",
5
+ "version": "0.6.76",
6
6
  "websiteUrl": "https://formvix.com/mcp",
7
7
  "packages": [
8
8
  {
9
9
  "registryType": "npm",
10
10
  "identifier": "formlab-mcp",
11
- "version": "0.6.74",
11
+ "version": "0.6.76",
12
12
  "runtimeHint": "npx",
13
13
  "transport": {
14
14
  "type": "stdio"
@@ -17,7 +17,9 @@ const _COLL = {
17
17
  ingredient: 'ingredients', equipment: 'equipment', parameter: 'parameters', template: 'templates', lot: 'lots', doeDesign: 'doeDesigns',
18
18
  };
19
19
 
20
- function _record(type, id, db) {
20
+ function _record(type, id, db, viewName) {
21
+ // VT (0225): a shared saved view (view:doe, view:compare, …): its name, kept with each comment.
22
+ if (/^view:/.test(String(type || ''))) return { uid: null, name: viewName || 'a shared view' };
21
23
  if (type === 'request') {
22
24
  const r = (db.requests || []).find(x => x && x.id === id);
23
25
  return r ? { uid: r.uid, name: r.title } : null;
@@ -42,11 +44,11 @@ function _notLive(db) {
42
44
  const list_discussions = {
43
45
  definition: {
44
46
  name: 'list_discussions',
45
- description: 'List discussion comments that sit beside records (formulas, batches, samples, test reports, projects, ingredients, equipment) or work requests — optionally filtered by the record (entity_type + entity_id, UID accepted), author, text, date, or only unresolved threads. Grouped by thread by default (each thread: the record, resolved or not, its comments oldest first); flat=true returns comments newest first. Comments are append-only: a retracted one keeps retracted = {at, reason} — treat it as withdrawn, not as a finding. "tab" says which tab of the record the comment was written on.',
47
+ description: 'List discussion comments that sit beside records (formulas, batches, samples, test reports, projects, ingredients, equipment), shared saved views (entity_type view:doe, view:compare, view:stability, view:test-analytics, view:find; entityName is the view name) or work requests — optionally filtered by the record (entity_type + entity_id, UID accepted), author, text, date, or only unresolved threads. Grouped by thread by default (each thread: the record, resolved or not, its comments oldest first); flat=true returns comments newest first. Comments are append-only: a retracted one keeps retracted = {at, reason} — treat it as withdrawn, not as a finding. "tab" says which tab of the record the comment was written on.',
46
48
  inputSchema: {
47
49
  type: 'object',
48
50
  properties: {
49
- entity_type: { type: 'string', description: 'formulation, batch, sample, testResult, project, ingredient, equipment, or request.' },
51
+ entity_type: { type: 'string', description: 'formulation, batch, sample, testResult, project, ingredient, equipment, request, or a shared saved view (view:doe, view:compare, view:stability, view:test-analytics, view:find; entity_id = the view\'s id).' },
50
52
  entity_id: { type: 'string', description: 'The record (internal id or UID, e.g. FORM-0012, REQ-0003).' },
51
53
  author: { type: 'string', description: 'Case-insensitive substring of the author\'s name.' },
52
54
  text_contains: { type: 'string', description: 'Case-insensitive substring of the comment text.' },
@@ -77,13 +79,13 @@ const list_discussions = {
77
79
  const flat = [...threads.values()].filter(l => !args.open_only || !resolvedOf(l)).flat().filter(keep)
78
80
  .sort((a, b) => Date.parse(b.at) - Date.parse(a.at));
79
81
  return { totalMatching: flat.length, returned: Math.min(flat.length, limit),
80
- comments: flat.slice(0, limit).map(c => { const rec = _record(c.entityType, c.entityId, db);
82
+ comments: flat.slice(0, limit).map(c => { const rec = _record(c.entityType, c.entityId, db, c.viewName);
81
83
  return { ...row(c), entityType: c.entityType, entityId: c.entityId, entityUid: rec ? rec.uid : null, entityName: rec ? rec.name : '' }; }) };
82
84
  }
83
85
  const out = [...threads.values()].map(list => {
84
86
  const comments = list.filter(keep);
85
87
  if (!comments.length) return null;
86
- const c0 = list[0], rec = _record(c0.entityType, c0.entityId, db), resolved = resolvedOf(list);
88
+ const c0 = list[0], rec = _record(c0.entityType, c0.entityId, db, (list.find(c => c.viewName) || {}).viewName), resolved = resolvedOf(list);
87
89
  if (args.open_only && resolved) return null;
88
90
  return { entityType: c0.entityType, entityId: c0.entityId, entityUid: rec ? rec.uid : null, entityName: rec ? rec.name : '',
89
91
  resolved, lastAt: list[list.length - 1].at, comments: comments.map(row) };
@@ -102,7 +104,7 @@ const list_requests = {
102
104
  status: { type: 'string', description: 'open, in_progress, blocked, done, cancelled; or "active" for open + in_progress + blocked.' },
103
105
  assignee: { type: 'string', description: 'Case-insensitive substring of the name of the person it is asked of.' },
104
106
  kind: { type: 'string', description: 'batch, tests, samples, review, other.' },
105
- entity_type: { type: 'string', description: 'The linked record\'s type (formulation, batch, sample, testResult, project).' },
107
+ entity_type: { type: 'string', description: 'The linked record\'s type (formulation, batch, sample, testResult, project), or a shared saved view (view:doe, view:compare, …).' },
106
108
  entity_id: { type: 'string', description: 'The linked record (internal id or UID).' },
107
109
  late_only: { type: 'boolean', description: 'true = only active requests past their due date.' },
108
110
  limit: { type: 'number', description: 'Max rows (default 100, max 1000).' },
package/vendor/cost.js CHANGED
@@ -1697,7 +1697,7 @@ function deviationTier(pct) {
1697
1697
  }
1698
1698
 
1699
1699
  // Plain-text tooltip + inline color legend for the deviation tiers.
1700
- const DEVIATION_TIP = 'Δ vs plan = worst-case wt-% drift of the as-prepared composition from the proposal. Colors: under 2% on-target (green), 2–10% drift (amber), 10%+ off-target (red).';
1700
+ const DEVIATION_TIP = 'Worst drift from the plan: green under 2%, amber 2–10%, red 10%+';
1701
1701
  function deviationLegendHtml() {
1702
1702
  const dot = c => `<span style="display:inline-block;width:8px;height:8px;border-radius:50%;background:${c};vertical-align:middle;margin-right:3px"></span>`;
1703
1703
  return `<span title="${DEVIATION_TIP}" style="font-size:10.5px;color:var(--dk-muted, #64748b);white-space:nowrap">Δ vs plan: ${dot('#15803d')}&lt;2% ${dot('#b45309')}2–10% ${dot('#b91c1c')}≥10%</span>`;
@@ -435,12 +435,18 @@ function _tpTrace(formula, rows) {
435
435
 
436
436
  // Scan a raw formula for parameter references. Returns
437
437
  // [{ name, start, end }] where start/end index the `[` and `]`.
438
- // Skips `ing[...]` / `ing.[...]` ingredient-field accesses.
438
+ // Skips `ing[...]` / `ing.[...]` ingredient-field accesses, and brackets inside
439
+ // quoted text ('Grade [A]' is text, not a reference, 51k). A quote inside a
440
+ // reference ([Supplier's grade]) doesn't open text: the reference is read whole.
439
441
  function _tpScanParamRefs(formula) {
440
442
  const s = String(formula || '');
441
443
  const refs = [];
444
+ let q = '';
442
445
  for (let i = 0; i < s.length; i++) {
443
- if (s[i] !== '[') continue;
446
+ const c = s[i];
447
+ if (q) { if (c === '\\') i++; else if (c === q) q = ''; continue; }
448
+ if (c === '"' || c === "'") { q = c; continue; }
449
+ if (c !== '[') continue;
444
450
  // An ingredient access has `ing` (optionally `ing.`) immediately before
445
451
  // the bracket — skip those; everything else is a parameter reference.
446
452
  if (/(^|[^A-Za-z0-9_])ing\s*\.?\s*$/.test(s.slice(0, i))) continue;