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.v20250618;
018
019import static org.apache.juneau.commons.utils.CollectionUtils.*;
020import static org.apache.juneau.commons.utils.Shorts.*;
021
022import java.util.*;
023
024import org.apache.juneau.marshall.*;
025
026/**
027 * Parameters for {@value McpMethods#TOOLS_CALL}.
028 */
029@Marshalled
030public class CallToolRequest {
031
032   private String name;
033   private Map<String,Object> arguments;
034
035   /**
036    * Tool name to invoke.
037    *
038    * @return The name, or {@code null} if not set.
039    */
040   public String getName() {
041      return name;
042   }
043
044   /**
045    * Sets the tool name.
046    *
047    * @param value The new value.  Can be <jk>null</jk> to unset the property.
048    * @return This object (for method chaining).
049    */
050   public CallToolRequest setName(String value) {
051      name = value;
052      return this;
053   }
054
055   /**
056    * Tool arguments (free-form object map).
057    *
058    * @return The arguments map, or {@code null} if not set.
059    */
060   public Map<String,Object> getArguments() {
061      return u(arguments);
062   }
063
064   /**
065    * Sets tool arguments.
066    *
067    * @param value The new value.  Can be <jk>null</jk> to unset the property.
068    * @return This object (for method chaining).
069    */
070   public CallToolRequest setArguments(Map<String,Object> value) {
071      arguments = value;
072      return this;
073   }
074
075   /**
076    * Convenience method to add a single tool argument.
077    *
078    * @param name The argument name.  Can be <jk>null</jk> ({@link LinkedHashMap} tolerates a <jk>null</jk> key).
079    * @param value The argument value.  Can be <jk>null</jk> (stored as <jk>null</jk>).
080    * @return This object (for method chaining).
081    */
082   public CallToolRequest putArgument(String name, Object value) {
083      if (arguments == null)
084         arguments = map();
085      arguments.put(name, value);
086      return this;
087   }
088}