Skip to content

[Proposal] Add support for UI Resource Templates in SEP-1865 #298

@rinormaloku

Description

@rinormaloku

Motivation

The current draft of SEP-1865 primarily focuses on static UI resources. However, the core Model Context Protocol already defines Resource Templates for dynamic URI resolution. If we support ResourceTemplates it would make Server-Side Rendering (SSR) for MCP Apps very-very powerful.

Proposed Specification Change

We should explicitly allow _meta.ui.resourceUri to be an MCP Resource Template (URI Template - RFC 6570).

  1. Alignment: Leverage the existing MCP mechanism where tools can reference template-based URIs.
  2. SSR Logic: Instead of the UI performing client-side data fetching, the request goes to the server for a specific resource and server the server generates the entire page (good old simple SSR).
  3. Efficiency: This allows the server to return pre-rendered HTML specifically for this resource.

Example

1. Tool Definition (on Server)
The server registers a tool with a template URI:

{
  "name": "get_pizza_details",
  "_meta": {
    "ui": { "resourceUri": "ui://pizzas/{pizzaId}/details" }
  }
}

2. Tool Response
The tool returns the specific ID in the structuredContent:

{
  "structuredContent": { "pizzaId": "margherita-123" }
}

3. Host Action
The Host extracts the pizzaId from the tool response and reads the resource template
ui://pizzas/margherita-123/details.

4. Server
Generates the details page for margherita-123.

Goal

To simplify the developer experience by allowing "0-JS" or low-JS apps, moving the logic from the sandboxed client back to the server.

Checkout this PR to see this concretely: #296

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions