Resource templates should support handlers

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
42/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
java

調査の方向性

まず、既存の (A)syncResourceSpecification と、リソースおよび prompts に使用されている登録経路を特定します。resource-template のリクエストがどのように処理されるかを追跡し、そのうえで、ハンドラーに対応できる仕様が URI パラメータについて何を公開する必要があるかを定義します。テンプレート化されたリソースがリクエストパラメータを解決してコンテンツを提供でき、すべての URI を事前登録する必要がなくなれば完了です。

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

説明

enhancement feature/repositories P2

Expected Behavior

There should be a ResourceTemplateSpecification, similar to (A)syncResourceSpecification, so that we can have access to an exchange and handle requests properly.

Current Behavior

Currently unlike resources or prompts, there's no way to define a handler for resource templates. The same spec is used in all contexts, but doesn't allow supplying a handler.

Context

This is a serious limitation which defeats the concept of resource templates. For example, we would like to implement something like this in Micronaut MCP:

@ResourceTemplate(uriTemplate = "file://my-resource/{item}", description="A templated resource")
    String templated(String item) {
        return "Hello, " + item;
    }

That is, the content of the template depends on the URI parameters. Today there's no way to do this because the only thing we can do is register resource templates, but no handlers. Therefore, in order to serve the resources, we have to register all of them as regular resources, which makes the templating redundant. This also assumes that we can know in advance all the combinations of valid path elements values, which is obviously not possible.

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

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

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

はじめの一歩

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

modelcontextprotocol/java-sdk のほかの issue

modelcontextprotocol/java-sdk の issue をすべて見る

似ている issue

Java の issue をもっと見る

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

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