mcp/server: add initial capability server option (#182)

This CL adds an option for servers to advertise support for features
that have not been added yet. This includes Prompts, Tools, and
Resources as these could be dynamically added after initialization.

Fixes: #135.
This commit is contained in:
Sam Thanawalla 2025-07-29 05:20:08 -04:00 • committed by GitHub
commit 2b6f7b5185
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -333,6 +333,22 @@ func TestServerCapabilities(t *testing.T) {
Tools: &toolCapabilities{ListChanged: true},
},
},
{
name: "With initial capabilities",
configureServer: func(s *Server) {},
serverOpts: ServerOptions{
HasPrompts: true,
HasResources: true,
HasTools: true,
},
wantCapabilities: &serverCapabilities{
Completions: &completionCapabilities{},
Logging: &loggingCapabilities{},
Prompts: &promptCapabilities{ListChanged: true},
Resources: &resourceCapabilities{ListChanged: true},
Tools: &toolCapabilities{ListChanged: true},
},
},
}
for _, tc := range testCases {