Add completion/complete for prompt and resource-template arguments #7
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add the Completion capability — argument autocomplete for prompt and resource-template parameters.
Goal
When a client lets a user pick a prompt or fill a resource-template URI, the server can suggest valid completions for each argument as the user types. This is a small quality-of-life win that costs little to implement.
Method to add
completion/complete{ ref: { type: "ref/prompt"|"ref/resource", name|uri }, argument: { name, value }, context?: { arguments?: {…} } }→{ completion: { values: [string, …], total?, hasMore? } }API for lmcp
Or a simpler form:
server.prompts["release_note"].complete = function(arg_name, value) … end.Capabilities
Scope (v1)
(ref_type, name, argument_name)).hasMoreif truncating.value.Out of scope
context.argumentsthrough.Depends on
Priority
Low. Standalone value is small; main benefit is rounding out the Prompts/Resources story. Quarter-day after those land.
Implemented. Added in lmcp.lua:
self.completionsstorage keyed byref_type:ref_id:arg_nameserver:complete(ref_type, ref_id, arg_name, fn)registration. fn(value, ctx) → list of strings.completion/completedispatch with: spec-mandated 100-item cap (truncates + hasMore=true), structured error -32602 for missing ref/argument, -32603 for handler exceptions, emptyvalues:[]when no completer is registered (spec-allowed)capabilities.completions = json.empty_objectadvertisement when at least one completer is registered OR opts.completions=truerelease_noteprompt'sversionargument (prefix-match against known tags)Verified live: caps include
completions:{}, prefix-match returns filtered list, empty value returns all, malformed ref/argument returns -32602, unknown ref/arg returns empty values.