@adcp/sdk API Reference - v7.9.0
    Preparing search index...

    Function canonicalizeAgentUrl

    • Canonicalize an agent URL for authorized_agents[].url comparison per the AdCP URL canonicalization rules (https://adcontextprotocol.org/docs/reference/url-canonicalization). Returns the canonical string or null if the input is unparseable.

      The full 8-step canonicalization (Punycode, percent-encoding decode, remove_dot_segments, etc.) is delegated to Node's WHATWG URL parser for most rules; this helper layers on the SDK-specific bits the parser doesn't do automatically: default-port stripping (already done by URL.host), unreserved-char percent-decoding, and fragment strip.

      Exported for callers building their own per-agent matching outside the resolver — e.g., TMP seller_agent_url validation.

      Parameters

      • raw: string

      Returns string | null