fix: stop declaring output fields the sanitiser strips - #571
Merged
Conversation
structuredContent is sanitised with removeNullFields before it leaves the server, so a null can never reach a client. Four tools nonetheless declared output fields as required-and-nullable and emitted null for them, so the MCP SDK's validation of the sanitised payload against the declared outputSchema failed the entire call with "Output validation error". get-workspace-insights was the reported case, and it is worse than a schema mismatch: the API removed folder_id from the workspace insights endpoint in Doist/Todoist#27366, and the SDK made folderId optional to stop parse failures. The field can never be populated again, so it is gone from the tool rather than declared optional. The same defect was latent elsewhere: get-project-activity-stats emitted a null weekItems on every call that did not ask for weekly counts, and get-project-health emitted nulls for a project without a description or completion data. Those fields, and get-overview's inbox, are now optional and omitted. removeNullFields is left in place. It saves tokens on every response, and the tools were making a promise it was always going to break. A registry-wide test now rejects any nullable field in a tool's output schema, since this is the third time the class has landed. Closes Doist/Issues#20842 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
3 tasks
doistbot
reviewed
Aug 12, 2026
doistbot
left a comment
Member
There was a problem hiding this comment.
This PR updates fix: stop declaring output fields the sanitiser strips. No issues were flagged in the reviewed diff.
doist-release-bot Bot
added a commit
that referenced
this pull request
Aug 12, 2026
## [12.5.5](v12.5.4...v12.5.5) (2026-08-12) ### Bug Fixes * stop declaring output fields the sanitiser strips ([#571](#571)) ([6e1d285](6e1d285))
Contributor
|
🎉 This PR is included in version 12.5.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Closes https://github.com/Doist/Issues/issues/20842. Replaces #570, which fixed the symptom by switching off
removeNullFieldsfor every tool.Short description
structuredContentis sanitised withremoveNullFieldson its way out, so a null can never reach a client. Four tools nonetheless declared output fields as required-and-nullable and emittednullfor them, and the MCP SDK validates the sanitised payload against the declaredoutputSchema— so the field it just stripped fails the whole call withOutput validation error. That is the crash Automations hit onget-workspace-insights.folderIdis a step worse than a schema mismatch. The API removedfolder_idfrom the workspace insights endpoint in Doist/todoist#27366, and the SDK madefolderIdoptional in Doist/todoist-sdk-typescript#655 to stop the parse failures that followed. Nothing can populate it again, so it is gone from the tool rather than declared optional — the tool takes no folder argument either.The same defect was latent in three more places:
get-project-activity-statsemitted a nullweekItemson every call that did not ask for weekly counts (the default),get-project-healthemitted nulls for any project without a description or completion data, andget-overview'sinboxwas nullable. All are now.optional()and omitted.removeNullFieldsstays. It saves tokens on every response and it was doing exactly what it says; the tools were declaring a contract it was always going to break.Since this is the third time the class has landed (#379 fixed it for
get-overview'sparentId/folderId),src/tools/output-schema-nullability.test.tsnow walks every registered tool's output schema and rejects any nullable field. It caughtget-overview'sinboxon its first run.PR Checklist
Feel free to leave unchecked or remove the lines that are not applicable.
getMcpServerAND exported insrc/index.ts.