Skip to content

Validate MCP item writes strictly (labels, non-string values, versions, limits, all issues) - #42

Merged
hkrlogic merged 1 commit into
mainfrom
fix/mcp-write-validation
Oct 14, 2026
Merged

hkrlogic merged 1 commit into
mainfrom
fix/mcp-write-validation

Conversation

@hkrlogic

Copy link
Copy Markdown
Owner

Tightens how agent writes (create_item, update_item) are checked against the library schema.

  1. Labels normalized like the UI (trim, lower case, dedupe) on every write. Migration 024_normalize_labels.sql backfills items.labels, published_snapshot.labels and previous_published_snapshot.labels; the published_version / review_by triggers are paused for the backfill so it does not count as a new publish. Over-long labels are refused, not truncated.
  2. No silent drops: non-string / non-string-array values are refused with the key names (null = not sent). summary on a plain General library is refused over MCP (internal callers unchanged).
  3. Optional version fields must match 1, 1.0, 1.0.2 when non-empty.
  4. Single source for default per-type max (src/items/field-limits.ts) used by the tool schema, save check and field/table/custom proposals. Fixes text default 200 (tool) vs 8,000 (save).
  5. All validation issues returned at once; humanItemMessage keeps unknown-field wording and the rest.

Tests: test/write-validation.test.ts (11 tests incl. migration). Docs: concepts.md (how writes are checked), CHANGELOG.

…g values and General summary, check optional versions, share field limits, report all issues
@hkrlogic
hkrlogic merged commit f7d0c2d into main Oct 14, 2026
6 checks passed
@hkrlogic
hkrlogic deleted the fix/mcp-write-validation branch October 14, 2026 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant