Repository navigation
Add outputSchema to ModelContextTool and RegisteredTool - #254
beaufortfrancois wants to merge 7 commits into
Conversation
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).
|
Is this still planned on being added? |
a7e008f to
a988ee0
Compare
I hope so :) 🤞 @domfarolino I've started experimenting with |
a988ee0 to
ec56f58
Compare
markafoltz
left a comment
There was a problem hiding this comment.
A few questions/comments about how the serialization result is passed around (might be missing some key idea)
markafoltz
left a comment
There was a problem hiding this comment.
Looks good % a few optional suggested edits
| <dt><code><var ignore>tool</var>["{{ModelContextTool/outputSchema}}"]</code></dt> | ||
| <dd> | ||
| <p>A JSON Schema object describing the expected output structure for the tool [[!JSON-SCHEMA]]. | ||
| Tool output is expected to conform to the provided schema, and [=agents=] may reject outputs |
There was a problem hiding this comment.
If this can be validated at the User Agent level, should this go a step further and throw an exception or fail the executeTools promise if the output does not match the schema?
There was a problem hiding this comment.
Good question! I guess it's related to #92
This PR adds an optional
outputSchemamember to theModelContextToolandRegisteredTooldictionaries to enable browser agents and in-page agents to help LLMs reliably reason about the return values of tools.While
responseConstraintwas previously discussed, that name is too specific to the Built-in AI / Prompt API. TheoutputSchemaname aligns directly with the MCP Tools specificationoutputSchemaused to define expected structured outputs with JSON Schema.FIX #9
Preview | Diff