Skip to content

fix(mcp): apply the message-id format rule on the agent tool - #1406

Merged
rmyndharis merged 2 commits into
mainfrom
fix/mark-read-id-format-on-mcp
Aug 19, 2026
Merged

fix(mcp): apply the message-id format rule on the agent tool#1406
rmyndharis merged 2 commits into
mainfrom
fix/mark-read-id-format-on-mcp

Conversation

@rmyndharis

Copy link
Copy Markdown
Owner

MarkChatReadDto rejects a whitespace-only entry in messageIds, but SessionMarkChatRead declared its own list and copied only the count bound. invokeTool parses the tool's schema and calls the service directly, so the DTO never applies on that path and [' '] reached the engine as a receipt key.

What changed

  • The pattern and its rejection message become exported constants beside the existing cap, and the agent tool holds them instead of restating the rule. Restating it is how the two surfaces drifted.
  • One test drives the real invokeTool path and asserts the service is never reached, since a 400 that still delegated would leave the defect in place. A well-formed id is sent through as the control.

Also in this PR

The [Unreleased] changelog entries had grown past anything the released sections carry: median 44 words against 34, longest 139 against a historical maximum of 80. They are rewritten to the same distribution (median 39, longest 57), keeping what a reader acts on. Contributor credit and the section headings are unchanged. Bundled here rather than split off because it is prose only and touches no code.

Verification

  • Removing the regex fails the new test alone; loosening the shared constant fails four tests across both surfaces, which is what shows the rule is shared rather than copied.
  • npm run build, npm test, npm run lint, npm run format:check, test:docs, test:scripts, and the openapi, SDK and contract gates. check-contract-shapes reports 320 pairs, unit 5851 tests.

Fixes #1405

The REST body rejects a whitespace-only entry in `messageIds`, but
`SessionMarkChatRead` declared its own list and copied only the count
bound. `invokeTool` parses the tool's schema and calls the service
directly, so the DTO never applies on that path and `['  ']` reached the
engine as a receipt key.

The pattern and its message move into exported constants next to the
existing cap, and the tool holds them rather than restating the rule.
Restating it is how the two surfaces drifted in the first place.
Entries under `[Unreleased]` had grown past anything the released
sections carry: median 44 words against 34, and a longest of 139 against
a historical maximum of 80. They read as explanations rather than
release notes.

Rewritten to the same distribution (median 39, longest 57), keeping what
a reader acts on and dropping the reasoning. Contributor credit and the
section headings are unchanged.
@rmyndharis
rmyndharis merged commit d594e40 into main Aug 19, 2026
16 checks passed
@rmyndharis
rmyndharis deleted the fix/mark-read-id-format-on-mcp branch August 19, 2026 17:34
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.

Mark-read message ids are format-checked on REST but not through the MCP tool

1 participant