Annotation Interface McpTool


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

The tool's name defaults to the name of the annotated method. Tool metadata such as title and description can be specified via the corresponding attributes. If omitted, these metadata fields will default to the value of the name attribute.

Example usage:


 @McpTool
 public String getWeather(String city) {
     // Method implementation...
 }
 
Author:
codeboyzhou
See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The description of the tool.
    The name of the tool.
    The title of the tool.
  • Element Details

    • name

      String name
      The name of the tool. Defaults to the name of the annotated method.
      Returns:
      the name of the tool
      Default:
      ""
    • title

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

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