Skip to content

Documentation / @agentick/mcp / completeDependent

Function: completeDependent()

completeDependent<K>(opts, fn): CompletionHandler

Defined in: protocol/completions.ts:126

Declares which sibling arguments must be resolved before this completion runs. If any required arg is missing from ctx.resolvedArguments, returns empty without invoking the loader.

ts
complete: {
  contractId: completeDependent(
    { requires: ["projectId"] },
    async (typed, { projectId }) => {
      const contracts = await db.contracts.find({ projectId });
      return contracts.map(c => c.id);
    },
  ),
}

Type Parameters

K

K extends string

Parameters

opts

requires

readonly K[]

fn

(value, deps) => readonly string[] | CompletionResult | Promise&lt;readonly string[] | CompletionResult>

Returns

CompletionHandler

Released under the ISC License.