@modelcontextprotocol/ext-apps - v0.4.0
    Preparing search index...

    Function getToolUiResourceUri

    • 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.

      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

      Error if resourceUri is present but invalid (not starting with "ui://")

      // New nested format (preferred)
      const uri = getToolUiResourceUri({
      _meta: { ui: { resourceUri: "ui://server/app.html" } }
      });

      // Deprecated flat format (still supported)
      const uri = getToolUiResourceUri({
      _meta: { "ui/resourceUri": "ui://server/app.html" }
      });