@@ -80,6 +80,42 @@ public function testGetCapabilitiesWhenPopulated(): void
8080 $ this ->assertFalse ($ capabilities ->logging );
8181 }
8282
83+ public function testSetCustomCapabilities (): void
84+ {
85+ $ serverCapabilities = new ServerCapabilities (
86+ tools: false ,
87+ toolsListChanged: true ,
88+ resources: false ,
89+ resourcesSubscribe: false ,
90+ resourcesListChanged: false ,
91+ prompts: false ,
92+ promptsListChanged: false ,
93+ logging: true ,
94+ completions: true ,
95+ );
96+ $ tool = $ this ->createValidTool ('test_tool ' );
97+ $ resource = $ this ->createValidResource ('test://resource ' );
98+ $ prompt = $ this ->createValidPrompt ('test_prompt ' );
99+ $ template = $ this ->createValidResourceTemplate ('test://{id} ' );
100+
101+ $ this ->registry ->registerTool ($ tool , fn () => 'result ' );
102+ $ this ->registry ->registerResource ($ resource , fn () => 'content ' );
103+ $ this ->registry ->registerPrompt ($ prompt , fn () => []);
104+ $ this ->registry ->registerResourceTemplate ($ template , fn () => 'template ' );
105+
106+ $ this ->registry ->setServerCapabilities ($ serverCapabilities );
107+
108+ $ capabilities = $ this ->registry ->getCapabilities ();
109+
110+ $ this ->assertFalse ($ capabilities ->tools );
111+ $ this ->assertFalse ($ capabilities ->resources );
112+ $ this ->assertFalse ($ capabilities ->prompts );
113+ $ this ->assertTrue ($ capabilities ->completions );
114+ $ this ->assertFalse ($ capabilities ->resourcesSubscribe );
115+ $ this ->assertTrue ($ capabilities ->logging );
116+ $ this ->assertTrue ($ capabilities ->toolsListChanged );
117+ }
118+
83119 public function testRegisterToolWithManualFlag (): void
84120 {
85121 $ tool = $ this ->createValidTool ('test_tool ' );
0 commit comments