Skip to content

Support parameter deserialisation to Java Objects using the MCPJsonMapper #836

@sdehors-ibm

Description

@sdehors-ibm

Expected Behavior
Although all the transports provided with the SDK require a jsonMapper they only deserialize inputs as Java maps.
It should be possible to specifiy the Java input types along with the schema so that the transports can deserialize into real Java objects

Same applies for output serialisation. Complex Java types cannot be used directly as output.

Current Behavior

Currently transports use the static method McpSchema.deserializeJsonRpcMessage(jsonMapper, <string>); that cannot be extended and does jsonMapper.readValue(jsonText, MAP_TYPE_REF);

Context

This would greatly simplify applying each request to real java methods with matching parameters. Without that an additional jackson deserialisation is necessary, making the first deserialisation to Map redundant. It's unnecessary code that each implementor must produce.

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