Annotation 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 -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionThe description of the tool parameter.booleanWhether the tool parameter is required.
-
Element Details
-
name
String nameThe name of the tool parameter.- Returns:
- the name of the tool parameter
-
-
-
description
String descriptionThe description of the tool parameter. Defaults to the value of thenameattribute.- Returns:
- the description of the tool parameter
- Default:
- ""
-
required
boolean requiredWhether the tool parameter is required. Defaults totrue.- Returns:
- whether the tool parameter is required
- Default:
- true
-