Documentation
¶
Overview ¶
Package resolve provides the shared name-to-UUID resolution helpers CHIP tools use to accept human-readable values where the Collibra APIs demand UUIDs. Users — and the LLM relaying them — speak in names ("Obsolete", "Marketing", "Jane Smith"); without resolution the model has no reliable way to discover the UUIDs and ends up guessing.
The contract is the same for every kind of reference: exactly one match resolves silently, no match returns a self-correcting error listing what would have been valid, and an ambiguous name returns an error naming every candidate with its UUID — never a silent pick of the first row.
Helpers return Go errors that the MCP SDK wraps as tool execution errors (isError: true), letting the calling model see the problem and self-correct. Mirrors the pkg/tools/validation precedent: one small shared package rather than a copy per tool.
Index ¶
- func CheckAssignees(refs []AssigneeRef) ([]clients.Assignee, error)
- func PickMatch(label, query string, candidates []NamedRef, hints Hints) (string, error)
- func ResolveAssignees(ctx context.Context, client *http.Client, checked []clients.Assignee) ([]clients.Assignee, error)
- func SuggestionSuffix(label string, names []string, max int) string
- func UserID(ctx context.Context, client *http.Client, value string, hints Hints) (string, error)
- type AssigneeRef
- type Hints
- type NamedRef
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckAssignees ¶
func CheckAssignees(refs []AssigneeRef) ([]clients.Assignee, error)
CheckAssignees validates everything about an assignee list that needs no request: each type is USER or GROUP, and each GROUP id is a UUID, since group names are not resolvable through the user lookup. It returns the list with types normalised and USER ids still as given, ready for ResolveAssignees.
Callers run it before any user lookup, so a malformed entry anywhere in the list is reported without spending a request.
func PickMatch ¶
PickMatch reduces the candidate matches for a single typed-in name to one UUID, or returns a self-correcting error. The "did you mean" list is drawn from the candidates themselves — for the enumerable sets (status, domain type) those are the full set; for name-searched sets they are the server-side substring matches.
func ResolveAssignees ¶
func ResolveAssignees(ctx context.Context, client *http.Client, checked []clients.Assignee) ([]clients.Assignee, error)
ResolveAssignees replaces each USER id in a list returned by CheckAssignees with that user's UUID. A UUID passes through with no request; an ambiguous name is an error naming every candidate rather than an assignment of a guessed person.
func SuggestionSuffix ¶
SuggestionSuffix renders a short list of valid names to append to a "not found" error so the model can self-correct in one step instead of round-tripping through another tool.
Types ¶
type AssigneeRef ¶
AssigneeRef is an assignee as a caller gave it: a USER as a UUID, email address, username or full name, or a GROUP as its UUID.
type Hints ¶
Hints customise the two failure messages for the calling tool's shape. Both are optional: an empty field falls back to the generic wording.
NotFound is appended to the "no <label> matching <value> found" error and should name the input forms the caller accepts. Ambiguity replaces the instruction clause in the ambiguity error — a filter passes "pass the UUID in <param> to disambiguate", a lookup tool with no such parameter says what to do instead. Candidates labels the "did you mean" list: the default claims the entries are the valid values, which is true of an enumerable set (status, domain type) but overstates a substring search's near misses.
type NamedRef ¶
NamedRef is a candidate match for a typed-in value. Ctx holds optional disambiguating context (e.g. a domain's type, a user's username) shown only when a name is ambiguous.
type User ¶
User is a resolved Collibra user. Only fields that are safe to show back to the model are carried: the UUID the APIs need, plus the username and display name that let a human confirm the right person was picked. The email address is deliberately absent — no CHIP tool returns one.
func UserRef ¶
UserRef resolves a user reference — a UUID, an email address, a username, or a display name such as "Jane Smith" — to that user, in that order of precedence. A UUID is returned as-is without any lookup; a value containing '@' goes to the exact email endpoint; otherwise one name search is made and an exact username wins over a display-name match, so a person whose username happens to be someone else's name still resolves to themselves.
A display name matching several enabled users is an error listing each candidate with its UUID, never an arbitrary pick: this runs mid-chain to fill another call's parameter, and a wrong id writes to the wrong person.