Skip to content

Input validation (Fixes #92) - #289

Open
arnabwithab wants to merge 1 commit into
webmachinelearning:mainfrom
arnabwithab:input-validation-92
Open

Input validation (Fixes #92)#289
arnabwithab wants to merge 1 commit into
webmachinelearning:mainfrom
arnabwithab:input-validation-92

Conversation

@arnabwithab

@arnabwithab arnabwithab commented Sep 3, 2026

Copy link
Copy Markdown

Fixes #92.

Implements the 2026-03-05 resolution (https://www.w3.org/2026/03/05-webmachinelearning-minutes.html#f5bd) (browser validates on all three layers; codify a JSON Schema subset). Defines the subset, adds meta-validation in registerTool() and input validation in executeTool() before invoking the tool, rejecting with a structured DataError for agent self-correction. Coordinates with #254 (outputSchema touches the same dictionaries).

Spec-only per #289 (comment) — WPT split to web-platform-tests/wpt#62426 (tentative, 2 files: executeTool DataError + registerTool TypeError).

Checklist

  • Subset: type, properties, required, enum, minimum/maximum, exclusiveMinimum/exclusiveMaximum, minLength/maxLength, pattern, items, prefixItems, additionalProperties:false, default, description (Draft 2020-12 [[!JSON-SCHEMA]])
  • Excluded with rationale: $ref/$defs (remote/DAG), unevaluatedProperties, format, contentEncoding/contentMediaType, dependentRequired/dependentSchemas etc. (only allowlist passes → TypeError)
  • registerTool(): after stringify → parse → valid WebMCP input schema check; reject TypeError
  • executeTool(): in parallel block after serializing inputObject → validate parsed inputArguments against stored tool definition/input schema before tool execute steps; on fail queue webmcp task sourceDataError {path,reason,schemaPath} JSON Pointer RFC 6901, no pending execution nor execute invocation
  • index.bs builds with no warnings (bikeshed --print=plain --dry-run --die-when=late)
  • Only index.bs changed (spec-only); WPT in WebMCP: tentative input validation tests for #92 web-platform-tests/wpt#62426 per review
  • Reviews: @domfarolino (3-layer taxonomy, resolution owner), @beaufortfrancois (Add outputSchema to ModelContextTool and RegisteredTool #254), @anssiko (chaired)

@arnabwithab
arnabwithab marked this pull request as ready for review September 3, 2026 10:05
@anssiko

anssiko commented Sep 3, 2026

Copy link
Copy Markdown
Member

Thanks for the contribution. Please split the WPT content into a separate PR and submit to https://github.com/web-platform-tests/wpt/tree/master/webmcp per https://web-platform-tests.org/writing-tests/index.html#submitting-tests

The editors to review the spec content.

Codify WebMCP JSON Schema subset (Draft 2020-12) per 2026-03-05 CG resolution.
Meta-validation in registerTool() (TypeError on invalid schema) and input
validation in executeTool() parallel block before tool execute steps
(DataError with {path,reason,schemaPath} for agent self-correction).

Spec-only per review; WPT split to web-platform-tests/wpt (tentative).
Coordinates with webmachinelearning#254 (outputSchema, same dictionaries).
@arnabwithab

Copy link
Copy Markdown
Author

WPT split: web-platform-tests/wpt#62426 (tentative, 2 files — executeTool DataError + registerTool TypeError per #92). Spec PR is now spec-only per review.

@arnabwithab

Copy link
Copy Markdown
Author

@anssiko let me know if all looks good :)

@arnabwithab

Copy link
Copy Markdown
Author

@domfarolino let me know your thoughts!

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.

Who owns the validation layer?

2 participants