11 Checked completion references🔗ℹ

(completion (target argument) handler) constructs and returns a completion descriptor under ordinary (require mcp). In #lang mcp it additionally registers that descriptor with the interface. The handler expression evaluates once during descriptor construction; the handler itself accepts a prefix and context and runs only when completion is requested.

For locally declared targets, expansion rejects targets other than prompts or resources, unknown argument names, and duplicate target/argument routes. The manifest records the target, argument, and declaration source without evaluating handler expressions. Resource and prompt bindings also export their static name and argument names through lexical transformer values. Imported and re-exported declarations retain argument checks through renaming; aliases of one imported declaration cannot define duplicate completion routes. Their manifest target records the original name and kind without instantiating the provider or its handlers. Host-supplied target information that the compiler cannot establish is marked dynamic. Interface construction checks target membership, argument existence, and duplicate routes for every completion, including descriptors supplied through the ordinary data API. Views remap retained completion targets and remove completions belonging to excluded targets.

These checks do not infer resource references hidden in arbitrary Racket handlers; complete cross-module interface-reference analysis remains a separate requirement.