Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/specification/draft/basic/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ Requests are sent from the client to the server or vice versa, to initiate an op
method: string;
params?: {
[key: string]: unknown;
_meta?: {
[key: string]: unknown;
allowPartial?: boolean;
}
};
}
```
Expand All @@ -49,6 +53,7 @@ Requests are sent from the client to the server or vice versa, to initiate an op
- Unlike base JSON-RPC, the ID **MUST NOT** be `null`.
- The request ID **MUST NOT** have been previously used by the requestor within the same
session.
- Requests **MAY** allow partial results by setting the `allowPartial` flag.

### Responses

Expand All @@ -60,6 +65,10 @@ Responses are sent in reply to requests, containing the result or error of the o
id: string | number;
result?: {
[key: string]: unknown;
_meta?: {
[key: string]: unknown;
hasMore?: boolean;
}
}
error?: {
code: number;
Expand All @@ -73,6 +82,8 @@ Responses are sent in reply to requests, containing the result or error of the o
- **Responses** are further sub-categorized as either **successful results** or
**errors**. Either a `result` or an `error` **MUST** be set. A response **MUST NOT**
set both.
- Results **MAY** set `hasMore` flag only if the corresponding request set the `allowPartial` flag.
The flag indicates that more responses with the same ID will follow.
- Results **MAY** follow any JSON object structure, while errors **MUST** include an
error code and message at minimum.
- Error codes **MUST** be integers.
Expand Down
8 changes: 4 additions & 4 deletions docs/specification/draft/basic/transports.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ MCP endpoint.
`Content-Type: application/json`, to return one JSON object. The client **MUST**
support both these cases.
6. If the server initiates an SSE stream:
- The SSE stream **SHOULD** eventually include JSON-RPC _response_ for the
- The SSE stream **SHOULD** eventually include JSON-RPC _response(s)_ for the
JSON-RPC _request_ sent in the POST body.
- The server **MAY** send JSON-RPC _requests_ and _notifications_ before sending the
JSON-RPC _response_. These messages **SHOULD** relate to the originating client
final JSON-RPC _response_. These messages **SHOULD** relate to the originating client
_request_.
- The server **SHOULD NOT** close the SSE stream before sending the JSON-RPC _response_
- The server **SHOULD NOT** close the SSE stream before sending the JSON-RPC _response(s)_
for the received JSON-RPC _request_, unless the [session](#session-management)
expires.
- After the JSON-RPC _response_ has been sent, the server **SHOULD** close the SSE
- After the final JSON-RPC _response_ has been sent, the server **SHOULD** close the SSE
stream.
- Disconnection **MAY** occur at any time (e.g., due to network conditions).
Therefore:
Expand Down
23 changes: 23 additions & 0 deletions docs/specification/draft/server/tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,29 @@ Providing an output schema helps clients and LLMs understand and properly handle
- Guiding clients and LLMs to properly parse and utilize the returned data
- Supporting better documentation and developer experience

## Content streaming

Tools might provide result as a stream of partial results:

```mermaid
sequenceDiagram
participant User
participant Client
participant Server

Note over Client,Server: Streaming
Client->>Server: tools/call
Server-->>Client: Tool partial result
Client-->>User: Content
Server-->>Client: Tool partial result
Client-->>User: Content
Server-->>Client: Tool partial result
Client-->>User: Content
```

_Unstructured_ content is incremental and the complete result can be acquired by concatenation.
_Structured_ content is not incremental unless the tool's output schema states otherwise.

## Error Handling

Tools use two error reporting mechanisms:
Expand Down
100 changes: 100 additions & 0 deletions schema/draft/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion schema/draft/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ export interface Request {
* If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
*/
progressToken?: ProgressToken;
/**
* If specified, the caller is requesting partial results for this request. The receiver is not obligated to return partial results.
*/
allowPartial?: boolean;
[key: string]: unknown;
};
[key: string]: unknown;
Expand All @@ -54,7 +58,13 @@ export interface Result {
/**
* See [specification/draft/basic/index#general-fields] for notes on _meta usage.
*/
_meta?: { [key: string]: unknown };
_meta?: {
/**
* If true, more results will follow.
*/
hasMore?: boolean;
[key: string]: unknown;
};
[key: string]: unknown;
}

Expand Down