Skip to content

mcp: a tool argument that fails the published JSON Schema is refused with a bare -32602 "Input validation error" (no code, no status) that echoes unknown keys verbatim #37411

Description

@objectstack-fleet

triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE

Triage: lands in area:ai · domain:server · Bug · priority:p3 · pm:queue · size S; rationale: a refusal convention gap on the MCP doors. The caller gets a refusal it can read, and only its own input back, so it is Impeded × developers only (rare configuration), p3.

Filing gate: ① · Source: fleet (found in the review of PR #37393 by the epic #37000 seat, relayed to triage) · reach: every tool on both MCP doors (HTTP and stdio), measured · evidence: measured.

维护者速读

  • 问题:外接 AI 调用工具时,参数不符合工具公布的格式,返回的是 SDK 自带的「Input validation error」,没有平台约定的错误代码,还会把调用方传错的键原样回显(实测一次回显 300 字符、含换行和空字符、列出九个键)。
  • 影响:只影响调用方自己,看到的是自己的输入,不算安全问题;但平台「每个拒绝都带代码」的约定在这条路上不成立,AI 客户端没法按代码处理。
  • 要你做什么:无。低优先级,排队等有人顺手做。

What happens

  • Over MCP, when a tools/call argument fails the tool's published JSON Schema, the SDK's own schema check refuses first with MCP error -32602: Input validation error.
  • The refusal carries no code or status from the platform's coded-refusal convention.
  • It echoes unknown keys verbatim. Measured: 300 characters with a raw newline and NUL, nine keys listed.
  • It applies to every tool on both doors (HTTP and stdio). The top-level case predates PR feat(service-knowledge): search_knowledge takes scope, granularity and groupBy #37393.

Expected

  • A schema refusal on either door carries the platform's coded-refusal shape (a stable code, and the status where the door has one), like the platform's own argument refusals.
  • Unknown keys are named in bounded, sanitised form: a capped count, with control characters stripped or escaped.

Done when

  • One test per door sends an argument that fails the schema (a wrong type and unknown keys) and asserts the coded refusal and the bounded key echo.
  • The behaviour is the same on HTTP and stdio.

Notes

Activity

  1. added
    bug
    pm:queue
    finding
    area:ai
    domain:server
    on Nov 26, 2026
  2. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

    Claim: PM loop round 1 · 2026-11-28T04:24Z
    Picked by card-pick.mjs --order area:ai --seat repo:objectstack#2 at 2026-11-28T04:14Z, p3 close-out (the area's claimable p2 cards are all taken this round). The maintainer in this seat's project, verbatim: 「ai你为什么没认领」 and 「并发5」.
    Session: session_01L6bhgV6i8jfWwSXjpWJrjA
    Thread session: session_01L6bhgU2PeRzoy1CXJoUHGp
    Account: os-sales
    Branch: claude/project-thread-lhc4oo (from main)
    Domain: domain:server
    Seat: repo:objectstack#2
    Area: s2-ai
    File surface: packages/mcp/src/** where a tools/call argument is checked against the tool's published JSON Schema on the HTTP and stdio doors; one test per door; one changeset. NOT packages/runtime/src/domains/mcp-authoring.ts (open PR #38013).
    Container & model: S, mode:thread, model: default tier — dispatch-gates.mjs --tier: "no path-derived mandate", effort: high (reason: the thread session serves effort high; get_session read by the thread)
    Clause-②: no
    Metadata-protocol: none
    Responsibility: a schema refusal on either MCP door carries the platform's coded-refusal shape, and unknown keys are named in bounded, sanitised form.
    Thread-read: none
    Premise: measured at filing (card body); the thread reproduces the bare -32602 on main first, and reports premise not reproduced with no fix if it does not.
    Serial constraints cleared: PR #38013 touches mcp-authoring.ts in packages/runtime, fenced out above; no open PR names -32602 or Input validation error (search 2026-11-28T04:21Z).

    The PR says Fixes #37411.

  3. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 28, 2026
  4. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-sales · session_01L6bhgU2PeRzoy1CXJoUHGp
    os-dev-report

    {
      "issue": 37411,
      "status": "done",
      "branch": "claude/project-thread-lhc4oo",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/38162",
      "session": "session_01L6bhgU2PeRzoy1CXJoUHGp",
      "premise_still_valid": true,
      "summary": "Reproduced on main (581ae76a): a validate_expression call over HTTP with a wrong type and ten unknown keys answered the SDK's own 'MCP error -32602: Input validation error' text, no code, no status, every key echoed with its raw newline and NUL. createPlatformMcpServer (the one seam both doors build through) now wraps the SDK's validateToolInput: the SDK still decides, and on its InvalidParams refusal the arguments are re-parsed to read the issues and answered as the coded tool error (VALIDATION_ERROR, 400, codedErrorResult shape). Unknown keys are echoed bounded and sanitised (new argument-echo.ts): at most 5 per object plus a count, each cut at 64 characters, control characters escaped; applied inside strictToolInput's error map (rename advice kept) and as a backstop at the seam for other producers. One doc sentence this change falsified (knowledge-rag.mdx) is corrected.",
      "tests": "packages/mcp/src/request-params.test.ts new describe: HTTP door, stdio door (real StdioServerTransport), plain-misspelling control; 10/10. pnpm --filter @objectstack/mcp test at 8ad61416: Test Files 88/88, Tests 1645/1645 (5 existing pins moved from the -32602 text to VALIDATION_ERROR/400). typecheck exit 0. Ablation (scripts/ablation-replace.mjs, src-imported so no rebuild): removing the seam call reds 4/10, removing the key-echo wrap reds both door tests on the key count; both restored to the HEAD blob.",
      "gates": "Local: dispatch-gates --commands re-derived at f55eeb73, 98 commands, 93 exit 0; NOT MEASURED locally (CI runs them): check:dual-build-cjs-loads :: exit 3 and spec check:skill-examples :: exit 3 (no built dist/declarations), check-plugin-teardown-shape --self-test :: exit 3 (shallow clone), check:query-options-erasure and check:type-check-debt :: exit 124 (300 s local cap); --ran reconciliation: 98 derived, 93 run, 3 NOT-MEASURED, 2 UNRUN. CI at f55eeb73 when written: Lint & Repo Gates success, TypeScript Type Check success, Build Core success, Dogfood Regression Gate success, Governed Surface Queue Guard success, Test UI success, Live E2E UI success, Check Changeset success; Test Core 1/3/6 in_progress; Test Core (10/10) failure = @objectstack/organizations elevated-organization-wall.wall.test.ts 'a system hook's write is refused' timed out (11 s against a 5 s timeout), a package with no dependency on @objectstack/mcp; one re-run of the failed job follows when the run completes. 8ad61416's Lint/TypeCheck lanes were cancelled by the f55eeb73 push.",
      "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
      "mcp_calls": "0 — no MCP GitHub tools",
      "api_writes": "2 relay strokes so far — pr_create (POST /repos/objectstack-ai/objectstack/pulls + POST /issues/38162/assignees os-sales), issue_patch (PATCH /issues/38162 body r2); this report via post-stamped.mjs",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": ["carrier: none · The Docs Drift Check's three listed pages (deployment/cli.mdx, protocol/objectql/types.mdx, releases v17/17-0.mdx) match only the literal unrecognized_keys; re-read, none describes the MCP door; noted in the PR, not filed."]
    }
  5. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

    Landed · 2026-11-28T08:35Z

    PR #38162 merged at 2026-11-28T08:33Z through the merge queue on the seat's ACCEPT (7235374909), and its Fixes line closed this card. What changed:

    • Both MCP doors answer a tool argument that fails its schema with a coded VALIDATION_ERROR 400, echoing the offending keys bounded and sanitised, instead of an uncoded failure.
    • The docs line describing that refusal now matches the shipped behaviour.

    It was ejected once by its own dogfood pins (fixed in head e25ef84), once by a cancelled runner, and once by the organizations wall-test timeout flake (#38221). pm:dispatched is cleared on this card.

  6. removed
    pm:dispatched
    on Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:aibugdomain:serverfindingpriority:p3

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions