GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(mcpx): validate CallTool arguments against inputSchema (-32602), warn on output mismatch (#1483) by dezren39 · Pull Request #1596 · developing-today/code

Conversation

@dezren39

@dezren39 dezren39 commented Oct 28, 2026 •
edited by blacksmith-sh Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Fixes #1483 (Phase 2 of #1481; queue task 1616). Gate: Phase 1 #1482 merged (PR #1570, main 1da6d84) — verified fresh this shift.

What

  • List time (internal/mcpclient/schemacheck.go, wired into ListTools on every connection): each tool's inputSchema/outputSchema is compiled with internal/schemaval, cached per tool keyed by schema hash. A schema that does not compile (unsupported dialect, unresolvable/external $ref, invalid or oversized) excludes the tool with a Warning carrying the cause — the x-mcp-header precedent, surfaced by the pool as server.warning.
  • Inputs, enforced: CallTool validates the marshalled arguments against the compiled input validator before the transport is touched. Failure returns a typed InvalidParamsError (-32602 via RPCCode()), naming the tool and the path-qualified reason; the upstream receives zero calls.
  • Gateway pass-through: the tools/call invoke path in internal/mcpserver relays an RPCCode() == -32602 error as a protocol error instead of converting it to an isError result (interface check — no import cycle).
  • Outputs, warn-only: a result's structuredContent is validated against the output validator; a violation records a Warning and the result is delivered unchanged.
  • Validation applies once a connection has listed tools (the pool always lists before calling, so the choke point is covered); a never-listed connection behaves exactly as before — no surprise tools/list is issued on a call's behalf. Tools with no schema behave exactly as today.

Tests

New defining tests in schemacheck_test.go: wrong-type / missing-required / additional-property arguments all fail -32602 with upstream call count 0; valid arguments reach the upstream; unsupported-dialect and unresolvable-$ref tools are absent from ListTools with warnings naming the cause; output violation is warn-only with the result unchanged.

Local (laptop): go test ./internal/mcpclient/... ./internal/mcpserver/... ./internal/pool/... — all pass.

Benchmark (triage budget: ≤100µs/op median, ≤1ms worst)

BenchmarkCallToolValidateArgs (nested schema, ~5 levels / ~20 properties): 41.6 µs/op on the laptop (Ryzen 7840U) for a full scripted CallTool round trip including validation — inside budget. Also recorded on #1483.

Conformance

Matrix rows json-schema-support-2020-12, json-schema-validate-per-dialect-and-error-on-unsupported, json-schema-document-dialects, json-schema-reject-unresolved-ref updated from gap #254 to implemented (both occurrences each).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chatgpt-codex-connector[bot] reacted with eyes emoji
All reactions
  • 👀 1 reaction
@dezren39
feat(mcpx): validate CallTool arguments against inputSchema, warn on …
7f7f87f
…output mismatch (#1483)

Phase 2 of #1481, consuming the Phase-1 schemaval core (#1482):

- ListTools compiles each tool input/output schema via internal/schemaval (cached per tool, keyed by schema hash); a tool whose schema does not compile (unsupported dialect, unresolvable $ref, invalid/oversized) is excluded with a Warning, the x-mcp-header precedent. Applies on every connection, not just modern HTTP.
- CallTool validates marshalled arguments against the compiled input validator before the transport is touched; failure is a typed InvalidParamsError carrying -32602 (RPCCode), naming the tool and the path-qualified reason; the upstream receives zero calls.
- The gateway invoke path in internal/mcpserver relays an RPCCode -32602 error as a protocol error instead of an isError tool result (interface check, no import cycle).
- structuredContent is validated against the output validator warn-only; the result is delivered unchanged.
- Validation applies once a connection has listed (the pool always lists before calling); a never-listed connection behaves exactly as before.
- Conformance matrix rows for the four json-schema ids updated from gap #254 to implemented.

Tests: defining tests in internal/mcpclient/schemacheck_test.go (wrong type / missing required / additional property rejected with upstream call count 0; valid args pass; unsupported dialect and unresolvable $ref excluded with warnings; output violation warn-only). Full mcpclient + mcpserver + pool suites pass on the laptop.
Benchmark (laptop, Ryzen 7840U): BenchmarkCallToolValidateArgs 41.6us/op for a full scripted CallTool round trip including validation of a ~5-level/~20-property nested schema — inside the triage budget of <=100us/op median.
@dezren39
dezren39 requested a review from a team as a code owner October 28, 2026 05:11
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 26 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 76dfdb31-0149-4025-ad8a-a019cca5db20
Commits

Reviewing files that changed from the base of the PR and between ea7272c and 6928005.

Files selected for processing: 12
  • pkgs/mcpx/docs/spec/conformance-matrix.md
  • pkgs/mcpx/internal/conformance/coverage_messages.go
  • pkgs/mcpx/internal/conformance/officialclient/main.go
  • pkgs/mcpx/internal/daemon/callerr.go
  • pkgs/mcpx/internal/e2e/callerr_test.go
  • pkgs/mcpx/internal/e2e/ceiling_test.go
  • pkgs/mcpx/internal/mcpclient/client.go
  • pkgs/mcpx/internal/mcpclient/schemacheck.go
  • pkgs/mcpx/internal/mcpclient/schemacheck_test.go
  • pkgs/mcpx/internal/mcpserver/server.go
  • pkgs/mcpx/internal/schemaval/schemaval.go
  • pkgs/mcpx/internal/schemaval/schemaval_test.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn

Comment @coderabbitai help to get the list of available commands.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-28T14:29:27.472406Z 6928005 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Oct 28, 2026
mcpx: Phase 3 of #1481 — validate elicitation form answers against requestedSchema in client.answer #1484
Closed
mcpx: Phase 2 of #1481 — validate tool arguments at CallTool (enforce, -32602) + structuredContent against outputSchema (warn-only) #1483
Closed
chatgpt-codex-connector[bot]
chatgpt-codex-connector Bot reviewed Oct 28, 2026
View reviewed changes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7f7f87f5a8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pkgs/mcpx/internal/mcpclient/schemacheck.go
Comment on lines +129 to +132
ts, ok := c.validatorsFor(name)
if !ok || ts.input == nil {
return nil
}

@chatgpt-codex-connector chatgpt-codex-connector Bot Oct 28, 2026

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Initialize validators on the connections that execute calls

For session- and call-scoped servers, this silently skips validation on production calls: Pool.RefreshSchemas lists tools on its catalogue connection and then releases that instance (internal/pool/pool.go:827-880), whereas Pool.Call acquires another connection and immediately calls CallTool without listing tools. The new connection therefore has no toolValidators, so invalid arguments reach the upstream and output validation is also skipped. The pool's cached schemas need to initialize the executing connection's validators, or that connection must load them before validation; listing on the separate catalogue connection does not cover this path.

Useful? React with 👍 / 👎.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pkgs/mcpx/internal/mcpserver/server.go
Comment on lines +1011 to +1013
var coded interface{ RPCCode() int }
if errors.As(err, &coded) && coded.RPCCode() == codeInvalidParams {
return fail(codeInvalidParams, err.Error())

@chatgpt-codex-connector chatgpt-codex-connector Bot Oct 28, 2026

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve validation error codes across the daemon boundary

When argument validation fails through the actual MCP gateway, this assertion never sees InvalidParamsError: mcpBackend.Call communicates with the daemon over HTTP (internal/cli/serve.go:122-156), and daemon.callErrorBody preserves RPC codes only for errors with reflected Code and Message fields (internal/daemon/callerr.go:161-203). The new error has neither field, so it becomes an HTTPError without RPCCode() or an upstream error envelope, and the gateway returns an isError tool result instead of the intended -32602 protocol error. Serialize and reconstruct the validation code across that boundary, including the asynchronous ask path, rather than relying only on an in-process interface assertion.

Useful? React with 👍 / 👎.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
This was referenced Oct 28, 2026
ci: Actions check runs stuck in queued across PRs — no runner pickup since ~05:00Z 2026-10-28 #1599
Closed
feat(mcpx): validate elicitation form answers against requestedSchema (#1484) #1606
Merged
@github-actions github-actions Bot assigned dezren39 Oct 28, 2026
@dezren39
fix(mcpx): gofmt server.go and register schemaval covers so TestMatri…
1113f75
…x passes (#1483)
@dezren39 dezren39 mentioned this pull request Oct 28, 2026
id(web): link/image destinations containing a tab or newline are corrupted on save — tab becomes %09, newline destroys the link (the #1019 fix only handles spaces) #1423
Closed
4 tasks
dezren39 added 2 commits October 28, 2026 02:56
@dezren39
fix(mcpx): explain client-side -32602 refusals with catalog diagnosti…
b4a06b8
…cs (#1483)

Phase 2 validation refused schema-moved calls in mcpclient before the
transport, so the daemon explainCall path (which only recognised
upstream rpcErrors) attached no diagnostics: five e2e tests failed in
CI (callerr x4, ceiling x1) and refused calls lost the schema-change
explanation every surface is built around.

- daemon: clientFault() recognises an error carrying RPCCode() -32602
  (interface assertion, the gateway precedent) and explainCall runs
  diagnose.CallError for it, so /v1/call, tasks, scripts and the CLI
  carry the same diagnostics as an upstream refusal.
- mcpclient: InvalidParamsError headline uses the canonical
  "Invalid params" spelling, matching upstream -32602 messages.
- e2e: two assertions that hardcoded the upstream headline
  ("mcp error -32602...") now expect the validator headline; the
  diagnostics assertions are unchanged.
@dezren39
fix(mcpx): flatten validation error trees instead of panicking on com…
4ff47f7
…binator failures (#1483)

schemaval.Validate read DetailedOutput as a flat list: interior units (anyOf/oneOf/allOf/not and other grouping keywords) carry a nil Error, so an argument failure through a combinator nil-pointer panicked the daemon — the mcpx conformance server-all leg crashed mid-suite on PR #1596 (196/51 vs main 272/0) and every later scenario failed to connect. Walk the output tree to its leaves instead. Regression tests: combinator cases in schemaval and a CallTool anyOf case in mcpclient (returns -32602, upstream untouched).
@dezren39

dezren39 commented Oct 28, 2026

Copy link
Copy Markdown
Member Author

Do not merge b4a06b8 — conformance found a real crash; fixed in 4ff47f7.

The mcpx conformance server-all failure on b4a06b8 was not informational noise: main's server-all is 272 passed / 0 failed, this PR's was 196/51. The run artifact's daemon log shows why — a nil-pointer panic in schemaval.(*Schema).Validate (schemaval.go:259) from mcpclient.validateToolArgs during http-header-validation; the daemon died (ECONNREFUSED / fetch failed afterwards) and every later scenario (tasks-, input-required-) failed to connect.

Root cause: Validate treated DetailedOutput() as a flat list, but it is a tree — interior units (every combinator failure: anyOf/oneOf/allOf/not, and other grouping keywords) carry sub-errors and a nil Error, so formatting the problems dereferenced nil. Simple leaf failures (all of Phase 1's tests) never hit it; Phase 2's call-path enforcement is the first production caller. Reproduced exactly with an anyOf schema (identical stack).

Fix (4ff47f7): walk the output tree to its leaves when flattening problems. Regression tests: combinator cases in schemaval (TestFlattenedCombinatorErrors) and a CallTool anyOf case in mcpclient (returns -32602 InvalidParamsError naming $.mode, upstream call count 0). Laptop: internal/schemaval, internal/mcpclient, internal/mcpserver, internal/pool, internal/daemon all pass; gofmt clean.

Note: PR #1606 (Phase 3 elicitation, #1484) validates through the same schemaval.Validate, so this fix covers that path too once both land.

Awaiting CI on 4ff47f7 — merge only when green incl. conformance.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

dezren39 added 2 commits October 28, 2026 04:36
@dezren39
Merge remote-tracking branch 'origin/main' into queue/1616-1483-callt…
8c5a2b6
…ool-validation

# Conflicts:
#	pkgs/mcpx/docs/spec/conformance-matrix.md
@dezren39
chore(mcpx): regenerate conformance matrix after main merge (#1483)
7406c4c
@dezren39 dezren39 mentioned this pull request Oct 28, 2026
id(web): AutoSaveManager's generic-error path drops a coalesced follow-up — an edit made during a failed save is never autosaved #1616
Closed
4 tasks
@dezren39
fix(mcpx): explicit null for an optional argument is an omission, not…
550585c
… a violation (#1483)

CallTool validation now drops null-valued non-required top-level properties from the copy it validates (SEP-2243: a null parameter is not provided); the wire arguments are unchanged and a null for a required property still fails -32602. This restores the client-2026-07-28 conformance checks http-custom-headers/omit-null, whose suite call sends verbose:null against a boolean schema.

officialclient: the no-arguments fallback now synthesizes minimal schema-valid arguments from each advertised tool's inputSchema instead of {}, restoring http-invalid-tool-headers/valid_tool (required region) under CallTool enforcement.
@dezren39

dezren39 commented Oct 28, 2026

Copy link
Copy Markdown
Member Author

Pushed 550585c2 fixing the one red check, client-2026-07-28 conformance (was 65/70 vs expected 67/68, with exactly 2 non-OAuth failures — both root-caused from the run's artifacts):

  • http-custom-headers · sep-2243-client-omit-null — the suite calls test_custom_headers_null with verbose: null against a boolean property schema; CallTool validation refused it (-32602) before the server ever saw the call. Fix: validation now treats an explicit null for a non-required top-level property as an omission (SEP-2243's own semantics: a null parameter is not provided). Only the validated copy changes — wire arguments are byte-identical — and a null for a required property still fails. New test TestCallToolNullForOptionalPropertyIsAnOmission covers both halves.
  • http-invalid-tool-headers · ClientKeepsValidTool — the suite gives the driver no arguments for valid_tool, and the officialclient fallback called it with {} against a required region. Fix: the fallback now synthesizes minimal schema-valid arguments from each advertised tool's inputSchema (one minimal value per required property) — what a schema-aware host does; suite-supplied and tabled calls are untouched.

Laptop verification: go test ./internal/mcpclient/ ./internal/mcpserver/ ./internal/conformance/ all pass, officialclient builds, vet clean. CI on this head is the deciding run.

— queue worker (repo-worker-code), lane A, task 1616 resume

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chatgpt-codex-connector[bot]
chatgpt-codex-connector Bot reviewed Oct 28, 2026
View reviewed changes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 550585c2cc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pkgs/mcpx/internal/mcpclient/schemacheck.go
Comment on lines +177 to +179
for key, value := range obj {
if string(bytes.TrimSpace(value)) == "null" && !ts.required[key] {
delete(obj, key)

@chatgpt-codex-connector chatgpt-codex-connector Bot Oct 28, 2026

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve nullable values required by composed schemas

When an input schema declares a required nullable property through allOf or $ref, requiredProps only reads the root-level required, so this removes a valid explicit null before validation. For example, {"type":"object","allOf":[{"required":["x"],"properties":{"x":{"type":["null","string"]}}}]} accepts {"x":null}, but the client instead validates {} and rejects the call with -32602 without contacting upstream. Preserve schema-valid nulls rather than deciding optionality solely from the root-level keyword.

Useful? React with 👍 / 👎.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@dezren39
Merge remote-tracking branch 'origin/main' into queue/1616-1483-callt…
6928005
…ool-validation

# Conflicts:
#	pkgs/mcpx/docs/spec/conformance-matrix.md
#	pkgs/mcpx/internal/mcpclient/client.go
@dezren39
dezren39 merged commit 9176f1d into main Oct 28, 2026
17 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@dezren39
dezren39 deleted the queue/1616-1483-calltool-validation branch October 28, 2026 14:39
This was referenced Oct 28, 2026
mcpx: re-issue a broken modern request once, tools/call gated on annotations (#1638) #1645
Merged
mcpx: Phase 2 of #1634 — re-issue a broken modern request once (tools/call gated on annotations) #1638
Closed
design(mcpx): JSON Schema validation of tool input and output — one validator at the client choke point #1481
Closed
@developing-today developing-today Bot mentioned this pull request Nov 9, 2026
Closure audit: every closed issue/PR verified; unmerged branches + unpushed worktrees inventoried #7079
Open
@dezren39 dezren39 mentioned this pull request Nov 26, 2026
AUDIT-7 Lane 4 — MERGED-PR-AUDIT: merged PRs since 2026-10-23 vs their spawning issues #13879
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@chatgpt-codex-connector chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@dezren39 dezren39

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

mcpx: Phase 2 of #1481 — validate tool arguments at CallTool (enforce, -32602) + structuredContent against outputSchema (warn-only)

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@dezren39
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.