Skip to content

fix(markdown-chat): preserve text-only MCP results in output envelopes - #16

Merged
devnoname120 merged 4 commits into
devnoname120:mainfrom
AKzar1el:fix/retain-text-only-chat-output-20261108
Nov 10, 2026
Merged

devnoname120 merged 4 commits into
devnoname120:mainfrom
AKzar1el:fix/retain-text-only-chat-output-20261108

Conversation

@AKzar1el

@AKzar1el AKzar1el commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Unstructured MCP tools can return useful text while Markdown-chat adds an empty structuredContent envelope. Clients that prefer structured output then see {} instead of the tool result. Metadata-only structured output can hide the text in the same way.

This change mirrors nonempty text into structuredContent.content when the tool has no original output schema and no upstream content field. The generated mirror stays within the configured structured-output budget, including JSON escaping and upstream metadata, before user notices and ticket handoffs are attached.

  • Preserve upstream content, metadata, error state, and non-text blocks for ordinary results; retain the existing schema-aware wrapping behavior.
  • Keep complete user notices and ticket handoff fields outside the ordinary output budget.
  • Return a bounded error without an empty structured envelope when the configured limit cannot fit the generated mirror.
  • Add six output-envelope regression tests and three pipeline tests covering small/default budgets, escaped and Unicode text, metadata collisions, arrays, full user notices, and tiny limits.

Validation at 5cbaf9370fcc1627ce61c9654cc425732f03d898:

  • cargo fmt --all --check and git diff --check: passed.
  • cargo clippy --locked --all-targets -- -D warnings: passed.
  • Focused output-envelope tests: 12 passed.
  • cargo test --locked --all -- --test-threads=4: 1,618 passed, 0 failed, 14 ignored.
  • Updated-head CI: all four jobs passed in run 42897843719, testing 853b8e6ff22600fbfceae8e60f0b4e5f648b0e7e.

The first local run at default concurrency timed out in the existing workspace-switch test's three-second wait. That test passed independently and in the complete four-thread run above.

A follow-up commit applies formatting only to the ticket-isolation test file inherited from main, satisfying the workflow's separate rustfmt --edition 2024 --check step. Both the Cargo formatting check and the explicit included-file check pass locally.

@devnoname120
devnoname120 merged commit e90f4e9 into devnoname120:main Nov 10, 2026
4 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