File tree Expand file tree Collapse file tree
server-common/src/main/java/io/a2a/server/agentexecution Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -224,6 +224,24 @@ public List<Task> getRelatedTasks() {
224224 return params != null ? params .tenant () : null ;
225225 }
226226
227+ /**
228+ * Extracts all text content from the message and joins with the newline delimiter.
229+ * <p>
230+ * This is a convenience method for getting text input from messages that may contain
231+ * multiple text parts. Non-text parts (images, etc.) are ignored.
232+ * <p>
233+ * <b>Examples:</b>
234+ * <pre>{@code
235+ * // Join with newlines (common for multi-paragraph input)
236+ * String text = context.getUserInput("\n");
237+ * }</pre>
238+ *
239+ * @return all text parts joined with newline, or empty string if no message
240+ */
241+ public String getUserInput () {
242+ return getUserInput ("\n " );
243+ }
244+
227245 /**
228246 * Extracts all text content from the message and joins with the specified delimiter.
229247 * <p>
@@ -245,12 +263,13 @@ public List<Task> getRelatedTasks() {
245263 * @param delimiter the string to insert between text parts (null defaults to "\n")
246264 * @return all text parts joined with delimiter, or empty string if no message
247265 */
248- public String getUserInput (String delimiter ) {
266+ public String getUserInput (@ Nullable String delimiter ) {
249267 if (params == null ) {
250268 return "" ;
251269 }
270+ String delim = delimiter ;
252271 if (delimiter == null ) {
253- delimiter = "\n " ;
272+ delim = "\n " ;
254273 }
255274 return getMessageText (params .message (), delimiter );
256275 }
You can’t perform that action at this time.
0 commit comments