Lifecycle Test Initialize Then Tools
Prove the handshake before the tool list, because a client never calls tools on a failed initialize
Use when: a new server is being validated against a real client for the first time
Avoid when: the transport is already proven and only a single tool changed
Procedure
- Send initialize with a supported protocolVersion and client info
- Assert protocolVersion, capabilities and serverInfo in the reply
- Send the initialized notification and expect no reply
- Send tools/list and assert every tool has a name, description and schema
- Call one tool and assert the result shape
- Record the whole sequence as a transcript fixture
Signals
- initialize returns before any tool call is attempted
- the initialized notification produces no response line
- tools/list returns a non-empty array with schemas
- the first tool call succeeds on the same connection
Patterns
1. Handshake
initialize -> initialized -> tools/list -> tools/call
2. No reply
notifications never produce a response id
3. Schema check
each tool has inputSchema.type == 'object'
Pitfalls
- Skipping the notification and wondering why a strict client stalls
- Calling a tool before initialize completes
- Asserting the tool list without checking schema presence
Done when
- the full sequence passes on one connection in one process
- the transcript fixture is committed