Annotation Interface McpTool
Marks a method as an MCP (Model Context Protocol) tool.
MCP tools are exposed to the LLM and can be called during completion.
They replace the legacy AgentTool annotation with a more
structured approach compatible with the Model Context Protocol.
Example:
@McpTool(
name = "get_weather",
description = "Get current weather for a location",
parameters = "{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\"}}}"
)
public String getWeather(AgentToolContext ctx, String location) {
return "Weather in " + location + ": Sunny, 25°C";
}
Use this instead of the legacy @AgentTool for new tools.
The old @AgentTool is kept for backward compatibility.-
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionHuman-readable description of what the tool does.The tool name used by the LLM to invoke it. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanWhether this tool only works in DMs.booleanWhether this tool only works in guild channels.String[]Keywords for tool discovery.JSON Schema describing the tool's parameters.Required permission level.intTool priority (higher = more important).
-
Element Details
-
name
String nameThe tool name used by the LLM to invoke it. -
description
String descriptionHuman-readable description of what the tool does. -
parameters
String parametersJSON Schema describing the tool's parameters. Should be a valid JSON Schema object string.- Default:
""
-
keywords
-
guildOnly
boolean guildOnlyWhether this tool only works in guild channels.- Default:
false
-
dmOnly
boolean dmOnlyWhether this tool only works in DMs.- Default:
false
-
permission
-
priority
int priorityTool priority (higher = more important).- Default:
0
-