001/* 002 * Copyright 2022-2026 Revetware LLC. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package com.soklet.annotation; 018 019import org.jspecify.annotations.NonNull; 020 021import java.lang.annotation.ElementType; 022import java.lang.annotation.Retention; 023import java.lang.annotation.RetentionPolicy; 024import java.lang.annotation.Target; 025 026/** 027 * Binds a parameter of an {@link McpTool} method as a published tool 028 * argument. 029 * <p> 030 * Requiredness is inferred from the declared parameter type: {@code T} is 031 * required and {@code Optional<T>} is optional. A blank {@link #name()} uses 032 * the source-level Java parameter name. Explicit names provide a stable public 033 * contract across Java refactoring. Use {@link McpToolProperty} to supply the 034 * corresponding schema metadata for a component of an ordinary typed input or 035 * output record. 036 * 037 * @author <a href="https://www.revetkn.com">Mark Allen</a> 038 */ 039@Target(ElementType.PARAMETER) 040@Retention(RetentionPolicy.RUNTIME) 041public @interface McpToolArgument { 042 /** 043 * The published argument name. 044 * 045 * @return the argument name, or an empty string to use the Java 046 * parameter name 047 */ 048 @NonNull 049 String name() default ""; 050 051 /** 052 * The optional human-readable argument title. 053 * 054 * @return the title, or an empty string if none is configured 055 */ 056 @NonNull 057 String title() default ""; 058 059 /** 060 * The optional human-readable argument description. 061 * 062 * @return the description, or an empty string if none is configured 063 */ 064 @NonNull 065 String description() default ""; 066}