modelcontextprotocol / modelcontextprotocol/java-sdk

Resource templates should support handlers

Aperta
#534 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

enhancement feature/repositories P2
Lingua principale
Java
Stelle
3.7k
Fork
1.1k
Merge medio
1g 15h
PR unite (30g)
9

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia individuando la (A)syncResourceSpecification esistente e i percorsi di registrazione utilizzati per le risorse e i prompt. Traccia il modo in cui vengono gestite le richieste di resource-template, quindi definisci cosa deve esporre una specifica in grado di gestire le richieste per i parametri URI. Il lavoro è completo quando le risorse basate su template possono risolvere i parametri della richiesta e fornire contenuti senza dover pre-registrare ogni URI.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
api, backend-api-design
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.