Video guide
MCP Client Capability Negotiation: A Practical Fallback and Tool Discovery Guide
A practical guide to validating MCP initialization, negotiating optional capabilities, recovering from tool discovery errors, and managing tool-list freshness.
Based on the article MCP Client Capability Negotiation: A Practical Fallback and Tool Discovery Guide.
Transcript
Treat Initialization as a Contract
An MCP client should treat every server as a negotiating partner, not as a promise that every advertised feature will work.
The MCP 2025-11-25 lifecycle begins with an initialize request.
The server returns a protocol version, server capabilities, and implementation information.
The client then sends an initialized notification before normal operation begins.
A client must not send ordinary requests before initialization completes.
A server must not issue normal requests before receiving the initialized notification.
Pings and logging are the exceptions permitted during that period.
Validate the Handshake
Do not accept an initialization response merely because the transport returned HTTP 200.
Check the JSON-RPC structure, response ID, result shape, and selected protocol version.
The client proposes a version it supports.
If the server supports it, the server should return that same version.
Otherwise, the server may return another version it supports.
If the client cannot support the selected version, the lifecycle specification says it should disconnect.
Do not silently continue with a guessed version.
For HTTP transports, subsequent requests must include the MCP-Protocol-Version header.
Negotiate Features One by One
Protocol compatibility and capability negotiation answer different questions.
Version compatibility asks whether two implementations can exchange protocol messages.
Capability negotiation asks which optional behaviors are available in the session.
The server capabilities object advertises optional features.
Examples include listChanged for change notifications and subscribe for resource-change subscriptions.
Enable an optional behavior only when the server explicitly advertises it and the client supports it.
Absence is not evidence of support.
Normalize the negotiated result into an internal capability matrix instead of scattering checks through business logic.
Build Explicit Fallbacks
Every optional feature needs a documented fallback that preserves useful work.
With listChanged, the server can notify the client when its tool list changes.
Without it, the client can refresh on a schedule, at the start of relevant workflows, or after another reliable trigger.
If discovery fails, keep the last known catalog only when its age and validity policy allow it.
Otherwise, mark the tools unavailable.
If a response schema is invalid, reject it and leave the previous catalog intact.
If a workflow requires newly deployed tools, fail closed or require fresh discovery before execution.
A missing optional feature should not become a failed connection.
Handle Discovery Failures Precisely
Tools list failures are not all equivalent.
A transport failure means the client does not currently know the server catalog.
A bounded retry may be appropriate before a consequential workflow begins.
A JSON-RPC error is not an empty tool list.
A structurally invalid response must be rejected.
Do not partially import it without a deliberate schema-repair policy.
If a tool disappears after discovery, refresh once and confirm it still exists.
Then retry the call or report that the action is unavailable.
Avoid an infinite refresh-and-retry loop.
A bounded refresh policy protects the agent and its upstream API budget.
Manage Freshness, Test Failures, and Read the Original
Use a freshness policy instead of treating a cached tool list as permanent truth.
Refresh during initialization, before freshness-sensitive workflows, after negotiated list-change notices, and after missing-tool errors.
Store the server identity, protocol version, discovery timestamp, available schema version, and transport or endpoint identity.
Expose negotiating, ready, degraded, and failed as separate states.
Test unsupported versions, missing capabilities, malformed initialization, discovery errors, invalid schemas, removed tools, stale caches, and unnegotiated notifications.
The original article, MCP Client Capability Negotiation: A Practical Fallback and Tool Discovery Guide, provides the complete implementation checklist and examples.