MCP argument completion: context and remaining suggestions
Complete prompt or resource-template arguments with prior context and inspect values, total and hasMore.
Identify what is being completed · 1. Check server support · 2. Include the earlier selection
At a glance
MCP Completion supplies suggestions for prompt arguments and resource-template arguments. It assists parameter entry before a call; it does not ask a model to complete the task. Following the specification example, this task completes framework text “fla” after Python has been chosen, displays suggestions and preserves the indication that more may exist. It uses the 2025-11-25 revision.
Runtime and applicability
- Article type
- Engineering practice
- Verified
- Applies to
- MCP Use the cited documentation and version scope. Not tested.
Execution locations and responsibilities
- MCP client parameter entry UI and server completion handler The client supplies context and displays results; the server validates input and returns controlled suggestions.
Arrows show the order of checks in the guide. Follow each step’s prerequisites, branches and stop conditions; unexecuted steps are not completed work.
When to use
- An existing prompt or resource template needs interactive parameter suggestions.
When not to use
- This flow does not execute tools, continue model text or query an unsupported server.
Identify what is being completed
A prompt is referenced by name and a resource template by URI. ref/prompt does not identify a resource template, and ref/resource does not execute a tool. The client needs the server’s published prompt or template and its argument definitions. The names code_review, language and framework come from the official example, not a guarantee that every server registers them.
1. Check server support
A supporting server must declare completions in its capabilities. Confirm that declaration from actual initialization before requesting completion. Without support, users may enter known values manually. Keep unsupported capability separate from an empty suggestion result because their causes differ.
2. Include the earlier selection
The user has selected language: python and is now entering framework: fla. argument identifies the current field and text; context.arguments carries already resolved parameters. For multi-argument prompts or templates, including that context lets the server narrow its suggestions.
{
"jsonrpc": "2.0",
"id": 11,
"method": "completion/complete",
"params": {
"ref": {"type": "ref/prompt", "name": "code_review"},
"argument": {"name": "framework", "value": "fla"},
"context": {"arguments": {"language": "python"}}
}
}
3. Interpret suggestions and remaining results
The specification example returns values: ["flask"], total: 1 and hasMore: false. Those are documented example values, not a response observed here. A response contains at most 100 suggestions ranked by relevance. The total match count is optional. When hasMore is true, the current list is incomplete; do not invent a cursor pagination interface that this method does not define.
| State | Handling |
|---|---|
| Suggestions available | Display values for user confirmation |
hasMore: true | Keep an incomplete-results indication; more specific input can narrow matches |
| Empty or partial result | Allow further editing without guessing a value |
| Method or parameter error | Keep the error and check capability and reference names |
Request control and information boundaries
The specification recommends client debouncing and appropriate caching, and requires input validation, rate limits and access control for sensitive suggestions. For this application, a cache key distinguishes the reference, current field and resolved context. Do not reuse another prompt’s or user’s suggestions indiscriminately. A suggestion is not a user selection or an executed action.
Completion and verification
- Reference type, object name, field and context match actual definitions.
- Read values; do not invent a missing total or call hasMore results complete.
- Apply request control and distinguish errors from empty results; isolate sensitive suggestions using actual authorization.
The cited MCP specification was read to check requests, results, capability and security. No server was connected and no completion query run. The JSON and suggestions are teaching examples. Sending, display, caching and error handling must use the actual negotiated client interface.
Sources
All links are official pages; verification dates are listed per source, and links point to the version checked.