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.rest.server.mcp; 018 019/** 020 * Revision-neutral tool descriptor returned from {@code tools/list}. 021 * 022 * <p> 023 * Supersedes the wire-level {@code Tool} bean. {@code outputSchema} is revision-neutral: structured 024 * tool output was introduced in {@code 2025-06-18}, and adapters narrow its schema shape for earlier 025 * revisions. Deliberately absent: {@code title}, which is specific to later MCP revisions and belongs 026 * on the revision-typed side of the adapter boundary. 027 */ 028public class McpToolSpec { 029 030 private String name; 031 private String description; 032 private McpSchema inputSchema; 033 private McpSchema outputSchema; 034 035 /** 036 * The tool name, used to route {@code tools/call} requests. 037 * 038 * @return The name, or <jk>null</jk> if not set. 039 */ 040 public String getName() { 041 return name; 042 } 043 044 /** 045 * Sets the tool name. 046 * 047 * @param value The new value. Can be <jk>null</jk> to unset the property. 048 * @return This object. 049 */ 050 public McpToolSpec setName(String value) { 051 name = value; 052 return this; 053 } 054 055 /** 056 * The human-readable tool description. 057 * 058 * @return The description, or <jk>null</jk> if not set. 059 */ 060 public String getDescription() { 061 return description; 062 } 063 064 /** 065 * Sets the tool description. 066 * 067 * @param value The new value. Can be <jk>null</jk> to unset the property. 068 * @return This object. 069 */ 070 public McpToolSpec setDescription(String value) { 071 description = value; 072 return this; 073 } 074 075 /** 076 * The tool's argument schema. 077 * 078 * @return The schema, or <jk>null</jk> if not set. 079 */ 080 public McpSchema getInputSchema() { 081 return inputSchema; 082 } 083 084 /** 085 * Sets the tool's argument schema. 086 * 087 * @param value The new value. Can be <jk>null</jk> to unset the property. 088 * @return This object. 089 */ 090 public McpToolSpec setInputSchema(McpSchema value) { 091 inputSchema = value; 092 return this; 093 } 094 095 /** 096 * The tool's structured result schema. 097 * 098 * @return The schema, or <jk>null</jk> if not set. 099 */ 100 public McpSchema getOutputSchema() { 101 return outputSchema; 102 } 103 104 /** 105 * Sets the tool's structured result schema. 106 * 107 * @param value The new value. Can be <jk>null</jk> to unset the property. 108 * @return This object. 109 */ 110 public McpToolSpec setOutputSchema(McpSchema value) { 111 outputSchema = value; 112 return this; 113 } 114}