Skip to content

Expose Nullable / Nonnull on public properties / methods #395

@david-christ

Description

@david-christ

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions