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 com.soklet.McpRequestStateMode; 020import com.soklet.McpProtocolVersion; 021import org.jspecify.annotations.NonNull; 022 023import java.lang.annotation.ElementType; 024import java.lang.annotation.Retention; 025import java.lang.annotation.RetentionPolicy; 026import java.lang.annotation.Target; 027 028/** 029 * Declares an MCP prompt handler method. 030 * <p> 031 * Soklet's annotation processor derives the prompt argument descriptors from 032 * parameters annotated with {@link McpPromptArgument}. Prompt arguments are 033 * strings and do not use JSON Schema. 034 * 035 * @author <a href="https://www.revetkn.com">Mark Allen</a> 036 */ 037@Target(ElementType.METHOD) 038@Retention(RetentionPolicy.RUNTIME) 039public @interface McpPrompt { 040 /** @return the required exact MCP revisions on which this prompt is available */ 041 @NonNull 042 McpProtocolVersion @NonNull [] protocolVersions(); 043 /** 044 * The prompt name published to MCP clients. 045 * 046 * @return the nonblank prompt name 047 */ 048 @NonNull 049 String name(); 050 051 /** 052 * The optional human-readable prompt 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 prompt description. 061 * 062 * @return the description, or an empty string if none is configured 063 */ 064 @NonNull 065 String description() default ""; 066 067 /** 068 * Client requests this prompt operation may emit during multi-round-trip 069 * handling. 070 * 071 * <p>A nonempty declaration requires the method to return 072 * {@code McpOperationResult} or a subtype. 073 * 074 * @return input-request declarations 075 */ 076 @NonNull 077 McpMayRequestInput @NonNull [] mayRequestInput() default {}; 078 079 /** 080 * The request-state contract for this prompt operation. 081 * 082 * <p>A mode other than {@link McpRequestStateMode#NONE} requires the method 083 * to return {@code McpOperationResult} or a subtype. 084 * 085 * @return request-state mode 086 */ 087 @NonNull 088 McpRequestStateMode requestStateMode() default McpRequestStateMode.NONE; 089}