modelcontextprotocol / modelcontextprotocol/go-sdk

Fix handling for nil pointers given user-provided output schema

Open
#691 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

breaking change P3 v2
Dominant language
Go
Stars
5.1k
Forks
543
Avg merge
1d 17h
Merged PRs (30d)
37

Description

Following up on some discussion in #685: When fixing #199, I was overly cautious about handling typed nils: if the user provided their own output schema, we wouldn't fix typed nils for them, and so returning 'nil' would result in a missing structured output, rather than its zero value.

This was wrong: switching from an inferred schema to a user-provided schema shouldn't change the handling of nil, and structured output, if provided, must be an object.

PR incoming.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading issues #199 and #685 for the prior typed-nil handling discussion, then locate the implementation and tests covering user-provided output schemas. Verify that nil values are handled consistently with inferred schemas and that structured output remains an object; the issue notes that a PR is incoming.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.