Annotation Interface McpToolParam


@Target(PARAMETER) @Retention(RUNTIME) public @interface McpToolParam
This annotation is used to mark a method parameter as an MCP (Model Context Protocol) tool parameter.

The parameter's name must be specified explicitly. Parameter metadata such as description and required status can be specified via the corresponding attributes. If omitted, these metadata fields will default to the value of the name attribute and false.

Example usage:


 @McpTool
 public String getWeather(@McpToolParam(name = "city") String city) {
     // Method implementation...
 }
 
Author:
codeboyzhou
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The name of the tool parameter.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The description of the tool parameter.
    boolean
    Whether the tool parameter is required.
  • Element Details

    • name

      String name
      The name of the tool parameter.
      Returns:
      the name of the tool parameter
    • description

      String description
      The description of the tool parameter. Defaults to the value of the name attribute.
      Returns:
      the description of the tool parameter
      Default:
      ""
    • required

      boolean required
      Whether the tool parameter is required. Defaults to true.
      Returns:
      whether the tool parameter is required
      Default:
      true