001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.juneau.bean.mcp.v20250618; 018 019import static org.apache.juneau.commons.utils.CollectionUtils.*; 020import static org.apache.juneau.commons.utils.Shorts.*; 021 022import java.util.*; 023 024import org.apache.juneau.marshall.*; 025 026/** 027 * MCP server capability advertisement in {@link InitializeResult}. 028 */ 029@Marshalled 030public class ServerCapabilities { 031 032 private ToolCapability tools; 033 private PromptCapability prompts; 034 private ResourceCapability resources; 035 private LoggingCapability logging; 036 private CompletionCapability completions; 037 private Map<String,Object> experimental; 038 039 /** 040 * Tools capability. 041 * 042 * @return The capability, or {@code null} if not set. 043 */ 044 public ToolCapability getTools() { 045 return tools; 046 } 047 048 /** 049 * Sets tools capability. 050 * 051 * @param value The new value. Can be <jk>null</jk> to unset the property. 052 * @return This object (for method chaining). 053 */ 054 public ServerCapabilities setTools(ToolCapability value) { 055 tools = value; 056 return this; 057 } 058 059 /** 060 * Prompts capability. 061 * 062 * @return The capability, or {@code null} if not set. 063 */ 064 public PromptCapability getPrompts() { 065 return prompts; 066 } 067 068 /** 069 * Sets prompts capability. 070 * 071 * @param value The new value. Can be <jk>null</jk> to unset the property. 072 * @return This object (for method chaining). 073 */ 074 public ServerCapabilities setPrompts(PromptCapability value) { 075 prompts = value; 076 return this; 077 } 078 079 /** 080 * Resources capability. 081 * 082 * @return The capability, or {@code null} if not set. 083 */ 084 public ResourceCapability getResources() { 085 return resources; 086 } 087 088 /** 089 * Sets resources capability. 090 * 091 * @param value The new value. Can be <jk>null</jk> to unset the property. 092 * @return This object (for method chaining). 093 */ 094 public ServerCapabilities setResources(ResourceCapability value) { 095 resources = value; 096 return this; 097 } 098 099 /** 100 * Logging capability. 101 * 102 * @return The capability, or {@code null} if not set. 103 */ 104 public LoggingCapability getLogging() { 105 return logging; 106 } 107 108 /** 109 * Sets logging capability. 110 * 111 * @param value The new value. Can be <jk>null</jk> to unset the property. 112 * @return This object (for method chaining). 113 */ 114 public ServerCapabilities setLogging(LoggingCapability value) { 115 logging = value; 116 return this; 117 } 118 119 /** 120 * Completions capability. 121 * 122 * @return The capability, or {@code null} if not set. 123 */ 124 public CompletionCapability getCompletions() { 125 return completions; 126 } 127 128 /** 129 * Sets completions capability. 130 * 131 * @param value The new value. Can be <jk>null</jk> to unset the property. 132 * @return This object (for method chaining). 133 */ 134 public ServerCapabilities setCompletions(CompletionCapability value) { 135 completions = value; 136 return this; 137 } 138 139 /** 140 * Experimental capability extensions. 141 * 142 * @return The experimental map, or {@code null} if not set. 143 */ 144 public Map<String,Object> getExperimental() { 145 return u(experimental); 146 } 147 148 /** 149 * Sets experimental extensions. 150 * 151 * @param value The new value. Can be <jk>null</jk> to unset the property. 152 * @return This object (for method chaining). 153 */ 154 public ServerCapabilities setExperimental(Map<String,Object> value) { 155 experimental = value; 156 return this; 157 } 158 159 /** 160 * Convenience method to add a single experimental extension entry. 161 * 162 * @param name The extension name. Can be <jk>null</jk> ({@link LinkedHashMap} tolerates a <jk>null</jk> key). 163 * @param value The extension value. Can be <jk>null</jk> (stored as <jk>null</jk>). 164 * @return This object (for method chaining). 165 */ 166 public ServerCapabilities putExperimental(String name, Object value) { 167 if (experimental == null) 168 experimental = map(); 169 experimental.put(name, value); 170 return this; 171 } 172}