addCompletion method
void
addCompletion({
- required String refType,
- required String refKey,
- required CompletionHandler handler,
Register a completion handler for argument autocompletion (spec
completion/complete).
refType is 'prompt' or 'resource'. refKey is the prompt name
or resource template URI; pass '*' to register a wildcard handler
that catches any ref of the given type. Pass refType = '*' for
a global fallback.
The handler receives the spec ref map, the argument map
({ name, value }), and the optional context.arguments map of
previously-resolved arguments.
Returns a map with spec shape {values, total?, hasMore?} where
values is List<String> clipped to 100 entries.
Implementation
void addCompletion({
required String refType,
required String refKey,
required CompletionHandler handler,
}) {
final key = refType == '*' ? '*' : '$refType:$refKey';
_completionHandlers[key] = handler;
}