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.net.URI;
023import java.util.Optional;
024
025/**
026 * Immutable text or binary contents returned for one MCP resource URI.
027 *
028 * <p>
029 * This type may gain reviewed permitted subtypes in Soklet 4.x; use a forward-compatible default when switching over its values.
030 *
031 * @author <a href="https://www.revetkn.com">Mark Allen</a>
032 */
033@ThreadSafe
034public sealed interface McpResourceContents
035                permits McpBlobResourceContents, McpTextResourceContents {
036        /** @return absolute normalized resource URI in ASCII wire form */
037        @NonNull
038        URI getUri();
039
040        /** @return resource MIME type, if supplied */
041        @NonNull
042        Optional<@NonNull String> getMimeType();
043
044        /** @return typed Apps policy and presentation hints, if supplied */
045        @NonNull
046        Optional<@NonNull McpAppResourceMetadata> getAppResourceMetadata();
047
048        /** @return immutable extension metadata */
049        @NonNull
050        McpJsonObject getMetadata();
051}