Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions specification/draft/apps.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1165,24 +1165,25 @@ Future versions may add additional settings:
Servers SHOULD check client (host would-be) capabilities before registering UI-enabled tools:

```typescript
import { registerAppTool } from "@modelcontextprotocol/ext-apps/server";

const hasUISupport =
clientCapabilities?.extensions?.["io.modelcontextprotocol/ui"]?.mimeTypes?.includes("text/html;profile=mcp-app");

if (hasUISupport) {
// Register tools with UI templates
server.registerTool("get_weather", {
// Register tools with UI templates using the helper
registerAppTool(server, "get_weather", {
description: "Get weather with interactive dashboard",
inputSchema: { /* ... */ },
_meta: {
ui: { resourceUri: "ui://weather-server/dashboard" }
}
});
}, async (args) => { /* ... */ });
} else {
// Register text-only version
// Register text-only version (no helper needed)
server.registerTool("get_weather", {
description: "Get weather as text",
inputSchema: { /* ... */ }
// No UI metadata
});
}
```
Expand Down
Loading