1. Define the HTML resource
Useresource() to return the HTML produced by your Vite build:
server directory, as in the quickstart. The URI identifies the resource; the reader loads the file. Supply the HTML MIME type on both the definition and its returned content.
2. Point the tool at the resource
Add this field to your existingtool() definition:
mcpResult() when you also need rich content or extra widget data.
3. Register both definitions
Pass the tool map and readonly resource list to your existingcreateServer() call:
Tool linking and visibility
For example, register a filter/refresh tool that the assistant does not need to discover:
refresh_weather. Export that map’s type to React, then call useToolCall("refresh_weather"). A model-visible initiating tool supplies the first widget result.
The host enforces visibility. Every call still needs the server’s usual authentication and application authorization. Keep registration static and provide useful assistant-facing results.
Permissions and CSP go on the returned HTML’s _meta.ui, as the widgetUi object above shows. See permissions and metadata and the generic resources, tool results, and authorization guides.