fix(mcp): strip null-valued schema types - #713
Merged
Merged
Conversation
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.
Summary
Some MCP servers emit invalid JSON Schema entries with
type: null. Senpipreviously copied those entries into TypeBox tool definitions unchanged, so
strict OpenAI-compatible providers rejected the request with HTTP 400 before
the model could answer.
This PR strips only JSON-null
typevalues at the first Senpi-owned MCP schemaconversion boundary. Valid JSON Schema null declarations (
type: "null"andtype: ["string", "null"]) remain unchanged, and every provider adapter nowreceives the sanitized MCP tool definition.
Changes
typekeys during recursive MCP schema conversion.types while pinning both valid null-type forms.
QA & Evidence
npm exec vitest -- --run packages/coding-agent/test/mcp/schema-compat.test.ts -t "strips null-valued type keywords recursively"type: nullremained at the root, nested property,and
anyOfbranch.OpenAI-compatible endpoint rejected any outbound
"type":null.turn 2, final marker returned, real auth unchanged.
local-ignore/qa-evidence/20260804-mcp-null-schema/.node .agents/skills/senpi-qa/scripts/mock-loop.mjs --with-mcp-tool mcp_fx_tool_1 --tool-args '{"value":"ok"}' --evidence mcp-null-schema-regressionpresent; real auth unchanged.
npm exec vitest -- --run packages/coding-agent/test/mcp/schema-compat.test.ts packages/coding-agent/test/mcp/register-call.test.ts— 16/16 passed.npm run check— passed.npm run build— passed across all workspaces.git diff --check— clean.Cleanup
Risks & Residuals
not alter valid
"null"type semantics or other schema keywords.registration boundary.
Report
Summary by cubic
Strip invalid
type: nullfrom MCP tool input schemas during conversion to TypeBox so strict OpenAI‑compatible providers stop rejecting requests. Valid null types ("null"and["string","null"]) are kept.typekeys during MCP schema conversion.anyOfbranch cases.packages/coding-agent/CHANGELOG.mdandmcp/changes.md.Written for commit 32dd776. Summary will update on new commits.