From bc593e049af0d20d6349602c38e2aa49f387b47c Mon Sep 17 00:00:00 2001 From: PederHP Date: Sat, 22 Feb 2025 12:55:13 +0100 Subject: [PATCH] Completions capability flag --- .../draft/server/utilities/completion.md | 21 +++++++++++++++++++ schema/draft/schema.json | 6 ++++++ schema/draft/schema.ts | 4 ++++ 3 files changed, 31 insertions(+) diff --git a/docs/specification/draft/server/utilities/completion.md b/docs/specification/draft/server/utilities/completion.md index 073bed99a..7e4ea4110 100644 --- a/docs/specification/draft/server/utilities/completion.md +++ b/docs/specification/draft/server/utilities/completion.md @@ -21,6 +21,18 @@ However, implementations are free to expose completion through any interface pat suits their needs—the protocol itself does not mandate any specific user interaction model. +## Capabilities + +Servers that support completions **MUST** declare the `completions` capability: + +```json +{ + "capabilities": { + "completions": {} + } +} +``` + ## Protocol Messages ### Requesting Completions @@ -113,6 +125,15 @@ sequenceDiagram - `total`: Optional total matches - `hasMore`: Additional results flag +## Error Handling + +Servers **SHOULD** return standard JSON-RPC errors for common failure cases: + +- Method not found: `-32601` (Capability not supported) +- Invalid prompt name: `-32602` (Invalid params) +- Missing required arguments: `-32602` (Invalid params) +- Internal errors: `-32603` (Internal error) + ## Implementation Considerations 1. Servers **SHOULD**: diff --git a/schema/draft/schema.json b/schema/draft/schema.json index 1f91ad461..d4333de63 100644 --- a/schema/draft/schema.json +++ b/schema/draft/schema.json @@ -1788,6 +1788,12 @@ "ServerCapabilities": { "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.", "properties": { + "completions": { + "additionalProperties": true, + "description": "Present if the server supports argument autocompletion suggestions.", + "properties": {}, + "type": "object" + }, "experimental": { "additionalProperties": { "additionalProperties": true, diff --git a/schema/draft/schema.ts b/schema/draft/schema.ts index 020704966..df237cf10 100644 --- a/schema/draft/schema.ts +++ b/schema/draft/schema.ts @@ -217,6 +217,10 @@ export interface ServerCapabilities { * Present if the server supports sending log messages to the client. */ logging?: object; + /** + * Present if the server supports argument autocompletion suggestions. + */ + completions?: object; /** * Present if the server offers any prompt templates. */