resolve

package
v0.0.71 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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

func PickMatch(label, query string, candidates []NamedRef, hints Hints) (string, error)

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

func SuggestionSuffix(label string, names []string, max int) string

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.

func UserID

func UserID(ctx context.Context, client *http.Client, value string, hints Hints) (string, error)

UserID resolves a user reference to the user's UUID. See UserRef for the accepted forms and the order they are tried in.

Types

type AssigneeRef

type AssigneeRef struct {
	ID   string
	Type string
}

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

type Hints struct {
	NotFound   string
	Ambiguity  string
	Candidates string
}

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

type NamedRef struct {
	ID   string
	Name string
	Ctx  string
}

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

type User struct {
	ID       string
	UserName string
	FullName string
}

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

func UserRef(ctx context.Context, client *http.Client, value string, hints Hints) (User, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL