modelcontextprotocol / modelcontextprotocol/java-sdk

More extensible CallToolRequest

オープン
#910 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

waiting for triage
主要言語
Java
スター
3.7k
フォーク
1.1k
平均マージ
1日 15時間
マージ済み PR(30日)
9

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず McpJsonMapper.java を読み、CallToolRequest がツール引数をどのようにデシリアライズするかを追跡します。既存の map ベースの動作を維持しながら、ツール固有のリクエスト解析でサポートされる拡張ポイントを定義し、関連するリクエストデシリアライズテストで選択した動作を検証します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
api, backend-api-design
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
静か
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。