Skip to content

Commit f83692c

Browse files
authored
docs(protocol): define messages before initialization completes (#2606)
1 parent 361d1d4 commit f83692c

4 files changed

Lines changed: 22 additions & 2 deletions

File tree

‎docs/protocol/v2/draft/error.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ This applies to `session/prompt` and `session/set_config_option`, and to `sessio
5555

5656
### Requests Before Initialization
5757

58-
Agents **MUST** reject any request other than `initialize` that arrives before initialization completes with `-32600`.
58+
Agents **MUST** reject any request other than `initialize` that arrives before initialization completes with `-32600`, and ignore notifications. They also reject an `initialize` repeated after another request with `-32600`. See [Before Initialization Completes](/protocol/v2/draft/initialization#before-initialization-completes).
5959

6060
## Unstable Features
6161

‎docs/protocol/v2/draft/initialization.mdx‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,16 @@ The Agent **MUST** respond with the chosen [protocol version](#protocol-version)
8383

8484
`capabilities.auth` is separate from this method surface. It advertises authentication-related extensions and does not change the availability rules for `auth/login` or `auth/logout`.
8585

86+
## Before Initialization Completes
87+
88+
Initialization completes when the Agent responds successfully to `initialize`. Until then:
89+
90+
- Clients **MUST NOT** send requests other than `initialize`. Agents reject them with `-32600` and ignore notifications. See [Requests Before Initialization](/protocol/v2/draft/error#requests-before-initialization).
91+
- Agents **MUST NOT** send requests or notifications.
92+
- If `initialize` fails, the connection is still uninitialized, and the Client **MAY** send `initialize` again, for example after correcting invalid params.
93+
94+
After initialization completes, the Client can repeat `initialize` only as described in [Repeating Initialization](#repeating-initialization).
95+
8696
## Protocol version
8797

8898
The protocol versions that appear in the `initialize` requests and responses are a single integer that identifies a **MAJOR** protocol version. This version is only incremented when breaking changes are introduced.

‎docs/protocol/v2/error.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ This applies to `session/prompt` and `session/set_config_option`, and to `sessio
5555

5656
### Requests Before Initialization
5757

58-
Agents **MUST** reject any request other than `initialize` that arrives before initialization completes with `-32600`.
58+
Agents **MUST** reject any request other than `initialize` that arrives before initialization completes with `-32600`, and ignore notifications. They also reject an `initialize` repeated after another request with `-32600`. See [Before Initialization Completes](/protocol/v2/initialization#before-initialization-completes).

‎docs/protocol/v2/initialization.mdx‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,16 @@ The Agent **MUST** respond with the chosen [protocol version](#protocol-version)
8383

8484
`capabilities.auth` is separate from this method surface. It advertises authentication-related extensions and does not change the availability rules for `auth/login` or `auth/logout`.
8585

86+
## Before Initialization Completes
87+
88+
Initialization completes when the Agent responds successfully to `initialize`. Until then:
89+
90+
- Clients **MUST NOT** send requests other than `initialize`. Agents reject them with `-32600` and ignore notifications. See [Requests Before Initialization](/protocol/v2/error#requests-before-initialization).
91+
- Agents **MUST NOT** send requests or notifications.
92+
- If `initialize` fails, the connection is still uninitialized, and the Client **MAY** send `initialize` again, for example after correcting invalid params.
93+
94+
After initialization completes, the Client can repeat `initialize` only as described in [Repeating Initialization](#repeating-initialization).
95+
8696
## Protocol version
8797

8898
The protocol versions that appear in the `initialize` requests and responses are a single integer that identifies a **MAJOR** protocol version. This version is only incremented when breaking changes are introduced.

0 commit comments

Comments
 (0)