@@ -314,7 +314,7 @@ public open class Server(
314314 * @throws IllegalStateException If the server does not support tools.
315315 */
316316 public fun addTool (tool : Tool , handler : suspend ClientConnection .(CallToolRequest ) -> CallToolResult ) {
317- check (options.capabilities.tools != null ) {
317+ checkNotNull (options.capabilities.tools) {
318318 logger.error { " Failed to add tool '${tool.name} ': Server does not support tools capability" }
319319 " Server does not support tools capability. Enable it in ServerOptions."
320320 }
@@ -368,7 +368,7 @@ public open class Server(
368368 * @throws IllegalStateException If the server does not support tools.
369369 */
370370 public fun addTools (toolsToAdd : List <RegisteredTool >) {
371- check (options.capabilities.tools != null ) {
371+ checkNotNull (options.capabilities.tools) {
372372 logger.error { " Failed to add tools: Server does not support tools capability" }
373373 " Server does not support tools capability."
374374 }
@@ -383,7 +383,7 @@ public open class Server(
383383 * @throws IllegalStateException If the server does not support tools.
384384 */
385385 public fun removeTool (name : String ): Boolean {
386- check (options.capabilities.tools != null ) {
386+ checkNotNull (options.capabilities.tools) {
387387 logger.error { " Failed to remove tool '$name ': Server does not support tools capability" }
388388 " Server does not support tools capability."
389389 }
@@ -398,7 +398,7 @@ public open class Server(
398398 * @throws IllegalStateException If the server does not support tools.
399399 */
400400 public fun removeTools (toolNames : List <String >): Int {
401- check (options.capabilities.tools != null ) {
401+ checkNotNull (options.capabilities.tools) {
402402 logger.error { " Failed to remove tools: Server does not support tools capability" }
403403 " Server does not support tools capability."
404404 }
@@ -418,7 +418,7 @@ public open class Server(
418418 prompt : Prompt ,
419419 promptProvider : suspend ClientConnection .(GetPromptRequest ) -> GetPromptResult ,
420420 ) {
421- check (options.capabilities.prompts != null ) {
421+ checkNotNull (options.capabilities.prompts) {
422422 logger.error { " Failed to add prompt '${prompt.name} ': Server does not support prompts capability" }
423423 " Server does not support prompts capability."
424424 }
@@ -451,7 +451,7 @@ public open class Server(
451451 * @throws IllegalStateException If the server does not support prompts.
452452 */
453453 public fun addPrompts (promptsToAdd : List <RegisteredPrompt >) {
454- check (options.capabilities.prompts != null ) {
454+ checkNotNull (options.capabilities.prompts) {
455455 logger.error { " Failed to add prompts: Server does not support prompts capability" }
456456 " Server does not support prompts capability."
457457 }
@@ -466,7 +466,7 @@ public open class Server(
466466 * @throws IllegalStateException If the server does not support prompts.
467467 */
468468 public fun removePrompt (name : String ): Boolean {
469- check (options.capabilities.prompts != null ) {
469+ checkNotNull (options.capabilities.prompts) {
470470 logger.error { " Failed to remove prompt '$name ': Server does not support prompts capability" }
471471 " Server does not support prompts capability."
472472 }
@@ -482,7 +482,7 @@ public open class Server(
482482 * @throws IllegalStateException If the server does not support prompts.
483483 */
484484 public fun removePrompts (promptNames : List <String >): Int {
485- check (options.capabilities.prompts != null ) {
485+ checkNotNull (options.capabilities.prompts) {
486486 logger.error { " Failed to remove prompts: Server does not support prompts capability" }
487487 " Server does not support prompts capability."
488488 }
@@ -507,7 +507,7 @@ public open class Server(
507507 mimeType : String = "text/html",
508508 readHandler : suspend ClientConnection .(ReadResourceRequest ) -> ReadResourceResult ,
509509 ) {
510- check (options.capabilities.resources != null ) {
510+ checkNotNull (options.capabilities.resources) {
511511 logger.error { " Failed to add resource '$name ': Server does not support resources capability" }
512512 " Server does not support resources capability."
513513 }
@@ -522,7 +522,7 @@ public open class Server(
522522 * @throws IllegalStateException If the server does not support resources.
523523 */
524524 public fun addResources (resourcesToAdd : List <RegisteredResource >) {
525- check (options.capabilities.resources != null ) {
525+ checkNotNull (options.capabilities.resources) {
526526 logger.error { " Failed to add resources: Server does not support resources capability" }
527527 " Server does not support resources capability."
528528 }
@@ -537,7 +537,7 @@ public open class Server(
537537 * @throws IllegalStateException If the server does not support resources.
538538 */
539539 public fun removeResource (uri : String ): Boolean {
540- check (options.capabilities.resources != null ) {
540+ checkNotNull (options.capabilities.resources) {
541541 logger.error { " Failed to remove resource '$uri ': Server does not support resources capability" }
542542 " Server does not support resources capability."
543543 }
@@ -552,7 +552,7 @@ public open class Server(
552552 * @throws IllegalStateException If the server does not support resources.
553553 */
554554 public fun removeResources (uris : List <String >): Int {
555- check (options.capabilities.resources != null ) {
555+ checkNotNull (options.capabilities.resources) {
556556 logger.error { " Failed to remove resources: Server does not support resources capability" }
557557 " Server does not support resources capability."
558558 }
0 commit comments