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.bean.mcp.v20260728; 018 019import org.apache.juneau.marshall.*; 020 021/** 022 * Result payload for {@value McpMethods#SAMPLING_CREATE_MESSAGE} (MCP sampling). Never 023 * dispatched through {@code McpRevision}; see {@link CreateMessageRequest}'s class Javadoc for the same 024 * plain-POJO/duplex-payload rationale. 025 */ 026@Marshalled 027public class CreateMessageResult { 028 029 private Role role; 030 private Content content; 031 private String model; 032 private String stopReason; 033 034 /** 035 * The generated message's role (real schema restricts this to {@code user}/{@code assistant}). 036 * 037 * @return The role, or {@code null} if not set. 038 */ 039 public Role getRole() { 040 return role; 041 } 042 043 /** 044 * Sets the role. 045 * 046 * @param value The new value. Can be <jk>null</jk> to unset the property. 047 * @return This object (for method chaining). 048 */ 049 public CreateMessageResult setRole(Role value) { 050 role = value; 051 return this; 052 } 053 054 /** 055 * The generated content — a single block ({@code text}/{@code image}/{@code audio}/{@code resource}). 056 * 057 * @return The content, or {@code null} if not set. 058 */ 059 public Content getContent() { 060 return content; 061 } 062 063 /** 064 * Sets the content. 065 * 066 * @param value The new value. Can be <jk>null</jk> to unset the property. 067 * @return This object (for method chaining). 068 */ 069 public CreateMessageResult setContent(Content value) { 070 content = value; 071 return this; 072 } 073 074 /** 075 * The model that generated the content. 076 * 077 * @return The model name, or {@code null} if not set. 078 */ 079 public String getModel() { 080 return model; 081 } 082 083 /** 084 * Sets the model name. 085 * 086 * @param value The new value. Can be <jk>null</jk> to unset the property. 087 * @return This object (for method chaining). 088 */ 089 public CreateMessageResult setModel(String value) { 090 model = value; 091 return this; 092 } 093 094 /** 095 * Why sampling stopped (commonly {@code endTurn}/{@code stopSequence}/{@code maxTokens}, but the schema 096 * also permits arbitrary server-defined strings, so this stays a plain {@code String}). 097 * 098 * @return The stop reason, or {@code null} if not set. 099 */ 100 public String getStopReason() { 101 return stopReason; 102 } 103 104 /** 105 * Sets the stop reason. 106 * 107 * @param value The new value. Can be <jk>null</jk> to unset the property. 108 * @return This object (for method chaining). 109 */ 110 public CreateMessageResult setStopReason(String value) { 111 stopReason = value; 112 return this; 113 } 114}