Documentation / @agentick/mcp / completeFromAsync
Function: completeFromAsync()
completeFromAsync(
fn):CompletionHandler
Defined in: protocol/completions.ts:166
Escape hatch — full control over the response. Use when you need to set total/hasMore explicitly, do custom matching, or read from ctx.resolvedArguments without declaring the dependency upfront. Output is still clamped to 100 values.
ts
complete: {
tag: completeFromAsync(async (value, ctx) => {
const tags = await db.tags.find({ name: { $like: `${value}%` } });
return {
values: tags.map(t => t.name),
total: tags.totalCount,
hasMore: tags.hasNext,
};
}),
}Parameters
fn
(value, ctx) => string[] | CompletionResult | Promise<string[] | CompletionResult>