modelcontextprotocol / modelcontextprotocol/java-sdk

Expose Nullable / Nonnull on public properties / methods

Open
#395 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement P3
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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.