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 literal string "Not specified" and false.

Example usage:


 @McpTool
 public String getWeather(@McpToolParam(name = "city") String city) {
     // Method implementation...
 }
 
作者:
codeboyzhou
  • 必需元素概要

    所需元素
    修饰符和类型
    必需的元素
    说明
    The name of the tool parameter.
  • 可选元素概要

    可选元素
    修饰符和类型
    可选元素
    说明
    The description of the tool parameter.
    boolean
    Whether the tool parameter is required.
  • 元素详细资料

    • name

      String name
      The name of the tool parameter.
      返回:
      the name of the tool parameter
    • description

      String description
      The description of the tool parameter. Defaults to the literal string "Not specified".
      返回:
      the description of the tool parameter
      默认值:
      ""
    • required

      boolean required
      Whether the tool parameter is required. Defaults to false.
      返回:
      whether the tool parameter is required
      默认值:
      false