modelcontextprotocol / modelcontextprotocol/java-sdk

Expose Nullable / Nonnull on public properties / methods

未关闭
#395 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

enhancement P3
主要语言
Java
星标
3.7k
派生
1.1k
平均合并
1 天 15 小时
30 天内合并 PR
9

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先检查与 CallToolResult.isError() 和 Content.priority() 相关的公共 Java SDK API,issue 指出它们虽然使用了包装的基本类型,但仍可能为 nullable。确定哪些公共属性和方法可以返回 null,然后验证它们的 nullability 是否通过注解明确公开,以便调用方能够识别 nullable 值。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
api
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。