Skip to content

Commit 4015eb0

Browse files
committed
Specify error for servers that require tasks
1 parent a9c679b commit 4015eb0

2 files changed

Lines changed: 46 additions & 2 deletions

File tree

‎docs/specification/draft/tasks.mdx‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,32 @@ The client and server declare support for the tasks extension in their respectiv
5858

5959
No extension-specific settings are currently defined; an empty object indicates support.
6060

61-
A server that has negotiated this extension **MAY** return `CreateTaskResult` in lieu of `CallToolResult` in response to any supported request at its own discretion and on a per-request basis. The server is the sole decider; clients do not signal task preference on the request itself. The client declaring the extension capability does not suggest that it requires a `CreateTaskResult` in response to that request.
61+
A server that has negotiated this extension **MAY** return `CreateTaskResult` in lieu of a standard result (e.g. `CallToolResult`) in response to any supported request at its own discretion and on a per-request basis. The server is the sole decider; clients do not signal task preference on the request itself. The client declaring the extension capability does not suggest that it requires a `CreateTaskResult` in response to that request.
6262

6363
A server **MUST NOT** return `CreateTaskResult` to a client that did not include the extension capability on its request, regardless of prior declarations. A client that has negotiated this extension **MUST** be prepared to handle either `CallToolResult` or `CreateTaskResult` in response to any supported request it issues. A client that receives `CreateTaskResult` in response to an unsupported request type **MUST** interpret this as an invalid response to the request.
6464

65+
If a server is unable to service a request to a client that does not declare this extension capability without returning `CreateTaskResult`, the server **MUST** return an error with the code `-32003` (Missing Required Client Capability), indicating the required extension in the error response:
66+
67+
```jsonl
68+
{
69+
"jsonrpc": "2.0",
70+
"id": 1,
71+
"error": {
72+
// MISSING_REQUIRED_CLIENT_CAPABILITY
73+
"code": -32003,
74+
// Message provided for example purposes only. The content of this example message is non-normative.
75+
"message": "Missing required client capability",
76+
"data": {
77+
"requiredCapabilities": {
78+
"extensions": {
79+
"io.modelcontextprotocol/tasks": {}
80+
}
81+
}
82+
}
83+
}
84+
}
85+
```
86+
6587
## Supported Methods
6688

6789
The following methods currently support task-augmented execution:

‎seps/2663-tasks-extension.md‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,32 @@ The client and server declare support for the tasks extension in their respectiv
8282

8383
No extension-specific settings are currently defined; an empty object indicates support.
8484

85-
A server that has negotiated this extension **MAY** return `CreateTaskResult` in lieu of `CallToolResult` in response to any supported request at its own discretion and on a per-request basis. The server is the sole decider; clients do not signal task preference on the request itself. The client declaring the extension capability does not suggest that it requires a `CreateTaskResult` in response to that request.
85+
A server that has negotiated this extension **MAY** return `CreateTaskResult` in lieu of a standard result (e.g. `CallToolResult`) in response to any supported request at its own discretion and on a per-request basis. The server is the sole decider; clients do not signal task preference on the request itself. The client declaring the extension capability does not suggest that it requires a `CreateTaskResult` in response to that request.
8686

8787
A server **MUST NOT** return `CreateTaskResult` to a client that did not include the extension capability on its request, regardless of prior declarations. A client that has negotiated this extension **MUST** be prepared to handle either `CallToolResult` or `CreateTaskResult` in response to any supported request it issues. A client that receives `CreateTaskResult` in response to an unsupported request type **MUST** interpret this as an invalid response to the request.
8888

89+
If a server is unable to service a request to a client that does not declare this extension capability without returning `CreateTaskResult`, the server **MUST** return an error with the code `-32003` (Missing Required Client Capability), indicating the required extension in the error response:
90+
91+
```jsonl
92+
{
93+
"jsonrpc": "2.0",
94+
"id": 1,
95+
"error": {
96+
// MISSING_REQUIRED_CLIENT_CAPABILITY
97+
"code": -32003,
98+
// Message provided for example purposes only. The content of this example message is non-normative.
99+
"message": "Missing required client capability",
100+
"data": {
101+
"requiredCapabilities": {
102+
"extensions": {
103+
"io.modelcontextprotocol/tasks": {}
104+
}
105+
}
106+
}
107+
}
108+
}
109+
```
110+
89111
### Supported Methods
90112

91113
The following methods currently support task-augmented execution:

0 commit comments

Comments
 (0)