Skip to content

Commit bac2064

Browse files
committed
pr comments
1 parent d412d56 commit bac2064

File tree

4 files changed

+66
-10
lines changed

4 files changed

+66
-10
lines changed

docs/specification/draft/server/tools.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ or data, behind a URI that can be subscribed to or fetched again by the client l
240240

241241
#### Structured Content
242242

243-
**Structured** content is returned as a JSON object in the `structuredContent` field of a result.
243+
**Structured** content is returned as a JSON object in the `structuredContent` field of a result.
244244

245245
For backwards compatibility, a tool that returns structured content SHOULD also return functionally equivalent unstructured content.
246246
(For example, serialized JSON can be returned in a `TextContent` block.)

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

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,49 @@ what is being completed through a reference type:
7676
}
7777
```
7878

79+
For prompts or URI templates with multiple arguments, clients should resolve them in the order they are presented by the server, and include each previous completion in the `context.arguments` object to provide context for subsequent requests.
80+
81+
**Request:**
82+
83+
```json
84+
{
85+
"jsonrpc": "2.0",
86+
"id": 1,
87+
"method": "completion/complete",
88+
"params": {
89+
"ref": {
90+
"type": "ref/prompt",
91+
"name": "code_review"
92+
},
93+
"argument": {
94+
"name": "framework",
95+
"value": "fla"
96+
},
97+
"context": {
98+
"arguments": {
99+
"language": "python"
100+
}
101+
}
102+
}
103+
}
104+
```
105+
106+
**Response:**
107+
108+
```json
109+
{
110+
"jsonrpc": "2.0",
111+
"id": 1,
112+
"result": {
113+
"completion": {
114+
"values": ["flask"],
115+
"total": 1,
116+
"hasMore": false
117+
}
118+
}
119+
}
120+
```
121+
79122
### Reference Types
80123

81124
The protocol supports two types of completion references:
@@ -117,6 +160,8 @@ sequenceDiagram
117160
- `argument`: Object containing:
118161
- `name`: Argument name
119162
- `value`: Current value
163+
- `context`: Object containing:
164+
- `arguments`: A mapping of already-resolved argument names to their values.
120165

121166
### CompleteResult
122167

schema/draft/schema.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,19 @@
333333
],
334334
"type": "object"
335335
},
336+
"context": {
337+
"description": "Additional, optional context for completions",
338+
"properties": {
339+
"arguments": {
340+
"additionalProperties": {
341+
"type": "string"
342+
},
343+
"description": "Previously-resolved variables in a URI template or prompt.",
344+
"type": "object"
345+
}
346+
},
347+
"type": "object"
348+
},
336349
"ref": {
337350
"anyOf": [
338351
{
@@ -342,13 +355,6 @@
342355
"$ref": "#/definitions/ResourceReference"
343356
}
344357
]
345-
},
346-
"resolved": {
347-
"additionalProperties": {
348-
"type": "string"
349-
},
350-
"description": "Previously-resolved variables in a URI template or prompt.",
351-
"type": "object"
352358
}
353359
},
354360
"required": [

schema/draft/schema.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,9 +1133,14 @@ export interface CompleteRequest extends Request {
11331133
};
11341134

11351135
/**
1136-
* Previously-resolved variables in a URI template or prompt.
1136+
* Additional, optional context for completions
11371137
*/
1138-
resolved?: { [key: string]: string };
1138+
context?: {
1139+
/**
1140+
* Previously-resolved variables in a URI template or prompt.
1141+
*/
1142+
arguments?: { [key: string]: string };
1143+
};
11391144
};
11401145
}
11411146

0 commit comments

Comments
 (0)