modelcontextprotocol / modelcontextprotocol/java-sdk
Expose Nullable / Nonnull on public properties / methods
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3.7k
- Forks
- 1.1k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 9
Description
Expected Behavior
Certain fields in MCP are mandatory, some are optional. I would expect to be able to know whether a certain property or function could be or return null from the Java SDK API.
Current Behavior
It is opaque to me what can be null or not.
Context
One example is CallToolResult, where isError() or Content.priority() are wrapped primitive types that can be null. However, since they don't have an @Nullable annotation, those facts are not obvious to the dev and can cause bugs (most notably null pointer exceptions).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the public Java SDK APIs around CallToolResult.isError() and Content.priority(), which the issue identifies as nullable despite using wrapped primitive types. Determine which public properties and methods can return null, then verify that their nullability is explicitly exposed through annotations so callers can identify nullable values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100