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;
018
019import org.jspecify.annotations.NonNull;
020
021import javax.annotation.concurrent.ThreadSafe;
022import java.util.Map;
023
024/**
025 * Immutable framework-supplied input for one MCP argument-completion request.
026 *
027 * <p>The partial value and context arguments are untrusted client input, not
028 * evidence of authorization or of a successfully completed operation. Missing
029 * ordinary required arguments are permitted while completing an argument.
030 *
031 * @author <a href="https://www.revetkn.com">Mark Allen</a>
032 */
033@ThreadSafe
034public interface McpCompletionContext {
035        /** @return declared name of the argument being completed */
036        @NonNull
037        String getArgumentName();
038
039        /** @return exact partial value supplied for the argument */
040        @NonNull
041        String getArgumentValue();
042
043        /** @return immutable map of supplied, declared context arguments */
044        @NonNull
045        Map<@NonNull String, @NonNull String> getContextArguments();
046
047        /**
048         * Completion input for a registered prompt.
049         *
050         * @author <a href="https://www.revetkn.com">Mark Allen</a>
051         */
052        @ThreadSafe
053        interface Prompt extends McpCompletionContext {
054                /** @return canonical prompt registration targeted by the request */
055                @NonNull
056                McpPromptRegistration getPromptRegistration();
057        }
058
059        /**
060         * Completion input for a registered resource URI template.
061         *
062         * @author <a href="https://www.revetkn.com">Mark Allen</a>
063         */
064        @ThreadSafe
065        interface Resource extends McpCompletionContext {
066                /** @return canonical resource-template registration targeted by the request */
067                @NonNull
068                McpResourceRegistration getResourceRegistration();
069        }
070}