Resource templates should support handlers

未關閉
#534 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
42/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
java

研究方向

首先定位現有的 (A)syncResourceSpecification,以及資源和 prompts 使用的註冊路徑。追蹤 resource-template 請求的處理方式,然後定義具備 handler 能力的 specification 必須為 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 小時
30 天內合併 PR
9

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

modelcontextprotocol/java-sdk 的其他 Issue

查看 modelcontextprotocol/java-sdk 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。