From PR #1484 review comment by @halter73:
The tool-side has three layers (attribute → builder → programmatic), but resource-side currently only has programmatic (SetResourceUi). There's no [McpAppResource] attribute and WithMcpApps() doesn't process the resource collection.
Server authors using attribute-based registration currently fall back to raw JSON strings in [McpMeta] to set UI metadata on resources, bypassing the typed McpUiResourceMeta / McpUiResourceCsp types.
Preferred approach:
Add [McpAppResource] mirroring [McpAppUi] and extend WithMcpApps() to iterate options.ResourceCollection. Then the sample can drop the raw JSON and use:
[McpServerResource(...)]
[McpAppResource(ConnectDomains = new[] { "https://api.weather.gov" }, PrefersBorder = true)]
public static string GetWeatherForecastUi() => ...;
Minimum:
Update the sample to call SetResourceUi() from a manual-registration code path in Program.cs so the typed types are exercised somewhere in user-facing docs.
Related to #1607.
From PR #1484 review comment by @halter73:
The tool-side has three layers (attribute → builder → programmatic), but resource-side currently only has programmatic (
SetResourceUi). There's no[McpAppResource]attribute andWithMcpApps()doesn't process the resource collection.Server authors using attribute-based registration currently fall back to raw JSON strings in
[McpMeta]to set UI metadata on resources, bypassing the typedMcpUiResourceMeta/McpUiResourceCsptypes.Preferred approach:
Add
[McpAppResource]mirroring[McpAppUi]and extendWithMcpApps()to iterateoptions.ResourceCollection. Then the sample can drop the raw JSON and use:Minimum:
Update the sample to call
SetResourceUi()from a manual-registration code path inProgram.csso the typed types are exercised somewhere in user-facing docs.Related to #1607.