Skip to main content

Module 17: Capability Negotiation

Client and agent agree on what each supports during initialization.

What You’ll Learn

  • Advertising ClientCapabilities during initialize()
  • Checking NegotiatedCapabilities from the agent side
  • Graceful degradation when a capability is missing

The Code

Client: Advertise capabilities

As of 0.80.0, initialize(InitializeRequest) is removed: capabilities (and now clientInfo) are set only on the client builder, and initialize() sends them. See the 0.80.0 migration guide.
Advertising terminal here would need all five terminal handlers registered too (createTerminalHandler, terminalOutputHandler, waitForTerminalExitHandler, killTerminalHandler, releaseTerminalHandler): build() checks every advertised capability has its handler, so this module keeps terminal out of its demo and leaves it to Module 18, which serves all five.

Agent: Advertise and check capabilities

Capability Categories

Clients advertise file system and terminal support. Agents advertise session resume, MCP server types, and content format support. Both sides can call getClientCapabilities() or getAgentCapabilities() after initialization to check what was negotiated.

Source Code

View on GitHub

Running the Example

Next Module

Module 18: Terminal Operations — execute shell commands through the terminal API.