Supports both the new nested format (_meta.ui.resourceUri) and the
deprecated flat format (_meta["ui/resourceUri"]). The new nested format
takes precedence if both are present.
Parameters
tool: {_meta?:Record<string,unknown>}
A tool object with optional _meta property
Returns string|undefined
The UI resource URI if valid, undefined if not present
Throws
Error if resourceUri is present but invalid (not starting with "ui://")
Example
// New nested format (preferred) consturi = getToolUiResourceUri({ _meta: { ui: { resourceUri:"ui://server/app.html" } } });
Extract UI resource URI from tool metadata.
Supports both the new nested format (
_meta.ui.resourceUri) and the deprecated flat format (_meta["ui/resourceUri"]). The new nested format takes precedence if both are present.