Skip to content

fix(update-doc): accept plain string insert in delta_format schema#342

Merged
LinoyMargan merged 3 commits into
masterfrom
bug-fix/linoy-margan/accept-plain-string-insert-in-delta-format
May 12, 2026
Merged

fix(update-doc): accept plain string insert in delta_format schema#342
LinoyMargan merged 3 commits into
masterfrom
bug-fix/linoy-margan/accept-plain-string-insert-in-delta-format

Conversation

@LinoyMargan
Copy link
Copy Markdown
Collaborator

Summary

  • The update_doc tool's DeltaOperationSchema only accepted insert as an object ({text: "..."}) but the LLM naturally generates standard Quill format with plain string inserts ({"insert": "Hello"}), causing schema validation to reject valid tool calls before execution
  • Added z.string().transform((s) => ({ text: s })) as the first union member — plain strings are coerced to the object form automatically; existing object-form inputs are unaffected
  • TypeScript, lint, and all 56 existing tests pass with no changes needed

Monday Item

https://monday.monday.com/boards/3713040192/pulses/11745156520

Test Plan

  • Existing tests pass: yarn test --testPathPattern="update-doc-tool" (56 tests)
  • TypeScript compiles clean: tsc --noEmit
  • Verify agent can call update_doc with plain string inserts (e.g. {"insert": "Hello world"}) without schema validation error

🤖 Generated with Claude Code

The LLM generates standard Quill delta ops with plain string inserts
(e.g. {"insert": "Hello"}) but the schema only accepted the object form
({"insert": {"text": "Hello"}}), causing schema validation to reject
valid tool calls before execution.

Added z.string().transform() as the first union member so plain strings
are automatically coerced to the object form. Existing object-form inputs
are unaffected.

Monday: https://monday.monday.com/boards/3713040192/pulses/11745156520

Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@LinoyMargan LinoyMargan force-pushed the bug-fix/linoy-margan/accept-plain-string-insert-in-delta-format branch from 73dc287 to 058a061 Compare May 12, 2026 06:15
LinoyMargan and others added 2 commits May 12, 2026 09:31
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@LinoyMargan LinoyMargan merged commit a3ff925 into master May 12, 2026
2 checks passed
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.

2 participants