{"modulePath":"github.com/OpenSoukAI/agent-mcp","version":"v0.1.7","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package endpointpath\n\nPackage endpointpath is the rule that maps a URL a merchant served to the product registered at that path. Only the path is compared: host, scheme, port and query are dropped, because a merchant behind a proxy sees an internal host and the query holds the buyer's input. A registered segment written {name} or :name matches any one segment.\n\n## Variables\n\n```go\nvar (\n\tErrInvalid   = errors.New(\"endpoint must be an http(s) URL or a path starting with /\")\n\tErrNoMatch   = errors.New(\"no registered endpoint matches\")\n\tErrAmbiguous = errors.New(\"several registered endpoints match\")\n\t// ErrPartialTemplate's text is shown to merchants as is.\n\tErrPartialTemplate = errors.New(\"a template parameter must be a whole path segment, like /files/{id}; a brace inside a segment, like file-{id}.json, is not supported\")\n)\n```\n\n## Functions\n\n```go\nfunc CheckTemplate(path string) error\n```\nCheckTemplate refuses a normalised registered path with a brace outside a whole {name} segment. Matching treats such a segment literally, so no request could ever resolve to it.\n\n```go\nfunc Concrete(raw, sample string) (string, error)\n```\nConcrete returns the full http(s) URL raw with every template parameter segment replaced by sample, so a templated endpoint can be probed. Everything else is kept byte-for-byte.\n\n```go\nfunc Conflicts(a, b string) bool\n```\nConflicts reports whether two normalised registered paths cannot both belong to one merchant: they are equal, or both are templates that some request would match. A fixed path beside a template is allowed, because the fixed one wins.\n\n```go\nfunc IsTemplate(path string) bool\n```\nIsTemplate reports whether any segment of a normalised path is a {name} or :name parameter.\n\n```go\nfunc Matches(registered, requested string) bool\n```\nMatches reports whether a normalised registered path (which may be a template) matches a normalised requested path.\n\n```go\nfunc Normalize(raw string) (string, error)\n```\nNormalize returns the path of a full http(s) URL or of a path starting with \"/\", without query, fragment or trailing slash (\"/\" for the root). Each segment is decoded on its own after the split, so an encoded slash cannot create a segment the merchant's router never saw; a segment that decodes to \"/\", \".\" or \"..\" is refused.\n\n```go\nfunc Resolve(registered []string, requested string) (int, error)\n```\nResolve returns the index in registered (normalised paths) of the path that serves requested: the equal fixed path, else the only matching template.\n\n","path":"github.com/OpenSoukAI/agent-mcp/internal/endpointpath","name":"endpointpath","synopsis":"Package endpointpath is the rule that maps a URL a merchant served to the product registered at that path.","isRedistributable":true}
