More extensible CallToolRequest

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

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Quiet
Tech stack
java

Research direction

Start by reading McpJsonMapper.java and trace how CallToolRequest deserializes tool arguments. Define the supported extension point for tool-specific request parsing while preserving the existing map-based behavior, then verify the chosen behavior with relevant request deserialization tests.

Written by the indexing model from the issue text.

Description

waiting for triage

Expected Behavior

We want to define our own tool-specific requests with own parsers for 'params'.

Current Behavior

The arguments for tool calls are always Maps.

Context

We develop our own MCP server that offers features like querying and we have our own set of tools to parse, validate and execute them.

The problem is that request object is always de-serialised as a map and we need to serialise it back or figure out a way to reconstruct our objects from the maps. It works most of the time, but is rather inconvenient for queries.

There is https://github.com/modelcontextprotocol/java-sdk/blob/main/mcp-core/src/main/java/io/modelcontextprotocol/json/McpJsonMapper.java, but as far as I understand, it is mainly used to decouple Jackson from the rest of the code.

We could have used that but it looks rather technical.

What I would like to have: some way to define my own request objects and make their payloads shallow or leave them unparsed so the each individual tool can later parse its payload and decide what to do. Or stick with standard map-based one if that is fine for it.

Dominant language
Java
Stars
3.7k
Forks
1.1k
Avg merge
1d 15h
Merged PRs (30d)
9

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.

More from modelcontextprotocol/java-sdk

All issues in modelcontextprotocol/java-sdk

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.