Skip to content

Commit 9291c0b

Browse files
committed
Update lifecycle spec
1 parent bc92a86 commit 9291c0b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

docs/spec/lifecycle.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,19 @@ This sequence ensures that both parties are aware of each other's capabilities a
4848
## Initialization
4949
The initialization process **MUST** begin with the client sending an `initialize` request to the server. This request **MUST** include:
5050

51-
- The *protocol version* supported by the client as a numeric integer
51+
- The *protocol version* supported by the client, as a string
5252
- The client's capabilities
5353
- Information about the client implementation
5454

55+
Protocol versions are represented as strings in the format `YYYY-MM-DD` (year–month–day, all zero-padded), and can be lexicographically compared—for example, `2024-10-07` is greater than `2024-10-06`.
56+
5557
{{<tabs items="Spec (TS),Example">}}
5658
{{<tab>}}
5759
```typescript
5860
export interface InitializeRequest extends Request {
5961
method: "initialize";
6062
params: {
61-
protocolVersion: number;
63+
protocolVersion: string;
6264
capabilities: ClientCapabilities;
6365
clientInfo: Implementation;
6466
};
@@ -72,7 +74,7 @@ export interface InitializeRequest extends Request {
7274
"id": 1,
7375
"method": "initialize",
7476
"params": {
75-
"protocolVersion": 1,
77+
"protocolVersion": "2024-10-07",
7678
"capabilities": {
7779
"experimental": {},
7880
"sampling": {}
@@ -98,7 +100,7 @@ The server **MUST** respond to the initialize request with an `InitializeResult`
98100
{{<tab>}}
99101
```typescript
100102
export interface InitializeResult extends Result {
101-
protocolVersion: number;
103+
protocolVersion: string;
102104
capabilities: ServerCapabilities;
103105
serverInfo: Implementation;
104106
}
@@ -110,7 +112,7 @@ The server **MUST** respond to the initialize request with an `InitializeResult`
110112
"jsonrpc": "2.0",
111113
"id": 1,
112114
"result": {
113-
"protocolVersion": 1,
115+
"protocolVersion": "2024-10-07",
114116
"capabilities": {
115117
"experimental": {},
116118
"logging": {},
@@ -130,7 +132,7 @@ The server **MUST** respond to the initialize request with an `InitializeResult`
130132
{{</tab>}}
131133
{{</tabs>}}
132134

133-
If the server cannot support the protocol version requested by the client, it **SHOULD** respond with an error.
135+
The server may choose a different protocol version than the client has requested. In such cases, it is up to the client whether to proceed with the connection or abort.
134136

135137
## Capability Exchange
136138

0 commit comments

Comments
 (0)