modelcontextprotocol / modelcontextprotocol/java-sdk

Resource templates should support handlers

Đang mở
#534 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

enhancement feature/repositories P2
Ngôn ngữ chính
Java
Star
3.7k
Fork
1.1k
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
9

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách xác định (A)syncResourceSpecification hiện có và các đường dẫn đăng ký được sử dụng cho resources và prompts. Theo dõi cách các yêu cầu resource-template được xử lý, sau đó xác định một specification có khả năng xử lý handler cần cung cấp những gì cho các tham số URI. Công việc được xem là hoàn tất khi các resource dạng template có thể phân giải các tham số của yêu cầu và cung cấp nội dung mà không cần đăng ký trước từng URI.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java
Lĩnh vực
api, backend-api-design
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
42/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.