Skip to content

Commit 4823482

Browse files
Merge pull request modelcontextprotocol#173 from PederHP/feat/completion_capability_as_optional
Completions capability flag
2 parents 868b1fd + bc593e0 commit 4823482

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

docs/specification/draft/server/utilities/completion.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ However, implementations are free to expose completion through any interface pat
2121
suits their needs—the protocol itself does not mandate any specific user
2222
interaction model.
2323

24+
## Capabilities
25+
26+
Servers that support completions **MUST** declare the `completions` capability:
27+
28+
```json
29+
{
30+
"capabilities": {
31+
"completions": {}
32+
}
33+
}
34+
```
35+
2436
## Protocol Messages
2537

2638
### Requesting Completions
@@ -113,6 +125,15 @@ sequenceDiagram
113125
- `total`: Optional total matches
114126
- `hasMore`: Additional results flag
115127

128+
## Error Handling
129+
130+
Servers **SHOULD** return standard JSON-RPC errors for common failure cases:
131+
132+
- Method not found: `-32601` (Capability not supported)
133+
- Invalid prompt name: `-32602` (Invalid params)
134+
- Missing required arguments: `-32602` (Invalid params)
135+
- Internal errors: `-32603` (Internal error)
136+
116137
## Implementation Considerations
117138

118139
1. Servers **SHOULD**:

schema/draft/schema.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,6 +1774,12 @@
17741774
"ServerCapabilities": {
17751775
"description": "Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.",
17761776
"properties": {
1777+
"completions": {
1778+
"additionalProperties": true,
1779+
"description": "Present if the server supports argument autocompletion suggestions.",
1780+
"properties": {},
1781+
"type": "object"
1782+
},
17771783
"experimental": {
17781784
"additionalProperties": {
17791785
"additionalProperties": true,

schema/draft/schema.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,10 @@ export interface ServerCapabilities {
234234
* Present if the server supports sending log messages to the client.
235235
*/
236236
logging?: object;
237+
/**
238+
* Present if the server supports argument autocompletion suggestions.
239+
*/
240+
completions?: object;
237241
/**
238242
* Present if the server offers any prompt templates.
239243
*/

0 commit comments

Comments
 (0)