Skip to content

Conversation

@findleyr
Copy link
Contributor

As reported in #199 and #200, the fact that we return a possibly "null" schema for pointer types breaks various clients, which expect schemas to be of type "object". This is an unfortunate footgun. For now, assume that the user wants us to treat pointers equivalently to non-pointers. If we want to change this behavior in the future, we can do so behind an option.

  • a test

Also fix the handling of nil results in the case where the output schema is non-nil: we must provide structured content in this case. (This was causing the test to fail).

Fixes #199
Fixes #200

@findleyr findleyr requested a review from jba August 20, 2025 23:17
@jba
Copy link
Contributor

jba commented Aug 21, 2025

This is thorough. But it won't merge at all after #325. I gutted newServerTool.
I'll wait for your rebase before reviewing. You may want to reintroduce setSchema, now that there is more logic to it.
Originally I was going to add an option to jsonschema.ForOptions for this, but your way is better.

As reported in modelcontextprotocol#199 and modelcontextprotocol#200, the fact that we return a possibly "null"
schema for pointer types breaks various clients, which expect schemas to
be of type "object". This is an unfortunate footgun. For now, assume
that the user wants us to treat pointers equivalently to non-pointers.
If we want to change this behavior in the future, we can do so behind an
option.

+ a test

Also fix the handling of nil results in the case where the output schema
is non-nil: we must provide structured content in this case. (This was
causing the test to fail).

Fixes modelcontextprotocol#199
Fixes modelcontextprotocol#200
@findleyr findleyr merged commit 43ad1eb into modelcontextprotocol:main Aug 21, 2025
5 checks passed
@findleyr findleyr deleted the pointers branch August 21, 2025 16:03
findleyr added a commit to findleyr/go-sdk that referenced this pull request Aug 21, 2025
Some bad merging in modelcontextprotocol#338 led to a bad bug in the handling of structured
output for pointer output types. Add a conformance test and fix the bug.
samthanawalla pushed a commit that referenced this pull request Aug 21, 2025
Some bad merging in #338 led to a bad bug in the handling of structured
output for pointer output types. Add a conformance test and fix the bug.
yasomaru pushed a commit to yasomaru/go-sdk that referenced this pull request Aug 28, 2025
Some bad merging in modelcontextprotocol#338 led to a bad bug in the handling of structured
output for pointer output types. Add a conformance test and fix the bug.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants