Skip to content

Change RegisteredTool#inputSchema type from DOMString to object - #241

Open
beaufortfrancois wants to merge 1 commit into
webmachinelearning:mainfrom
beaufortfrancois:inputSchemaObject
Open

Change RegisteredTool#inputSchema type from DOMString to object#241
beaufortfrancois wants to merge 1 commit into
webmachinelearning:mainfrom
beaufortfrancois:inputSchemaObject

Conversation

@beaufortfrancois

@beaufortfrancois beaufortfrancois commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

As discussed in #237 (comment), ModelContextTool#inputSchema was defined as an object during registration, but RegisteredTool#inputSchema returned a stringified JSON schema (DOMString) from getTools().
This change aligns RegisteredTool#inputSchema to be an object (JavaScript object), matching ModelContextTool#inputSchema and the MCP Tool specification.

Hopefully we'll apply the same reasoning to executeTool(myTool, {}) instead of executeTool(myTool, '{}') in #226


Preview | Diff

Comment thread index.bs
otherwise undefined.
:: the result of [=parse a JSON string to a JavaScript value=] given |tool
definition|'s [=tool definition/input schema=], if |tool definition|'s [=tool
definition/input schema=] is not the empty string; otherwise undefined.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's maybe leave a note under this saying that this will never throw an exception, because the string stored in the tool definition is always a valid JSON string.

Comment thread index.bs
registration.
:: A JSON Schema object describing the expected input parameters for the tool
[[!JSON-SCHEMA]]. It is the same value provided at tool registration, via
{{ModelContextTool/inputSchema}}.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It's not literally the same object, so it'll fail object identity == comparisons with the {{ModelContextTool/inputSchema}} object passed in at registration time. So depending on how you read "value", it might be confusing. Should we mention that it's a deep copy of the input schema?

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.

2 participants