Skip to content

Conversation

@jba
Copy link
Contributor

@jba jba commented Aug 22, 2025

The spec makes it clear that input schemas must have type "object". Enforce that.
Allow "any" as an input argument type by special-casing it.

Fixes #283.

The spec makes it clear that input schemas must have type "object".
Enforce that.
Allow "any" as an input argument type by special-casing it.

Fixes modelcontextprotocol#283.
@jba jba requested review from findleyr and samthanawalla August 22, 2025 11:10
Copy link
Contributor

@findleyr findleyr left a comment

Choose a reason for hiding this comment

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

This should have some updated doc comments on the restriction, probably on ToolFor and AddTool.

Also, we should add a test that calling ToolFor with a non-struct or map type (e.g. a slice or basic type) panics.

@jba jba merged commit 18c96d6 into modelcontextprotocol:main Aug 22, 2025
5 checks passed
yasomaru pushed a commit to yasomaru/go-sdk that referenced this pull request Aug 28, 2025
The spec makes it clear that input schemas must have type "object".
Enforce that.
Allow "any" as an input argument type by special-casing it.

Fixes modelcontextprotocol#283.
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.

addToolErr should fail if schema is not of type "object"

3 participants