Expected Behavior
@McpToolParam should support an optional name attribute to customize the external MCP tool argument name.
@McpTool(name = "get_weather")
public String getWeather(@McpToolParam(name = "city_name") String cityName) {
return cityName;
}
This should generate an input schema with city_name:
{
"type": "object",
"properties": {
"city_name": {
"type": "string"
}
},
"required": ["city_name"]
}
A tool call using city_name should bind to the Java parameter cityName.
Current Behavior
mcp/mcp-annotations currently uses the Java reflection parameter name for top-level tool input schema properties
and runtime argument binding.
For example:
@McpTool(name = "get_weather")
public String getWeather(String cityName) {
return cityName;
}
generates and expects cityName.
There is no MCP-specific way to expose city_name while keeping the Java method parameter named cityName.
Context
I want to expose MCP tool arguments using an external naming style such as snake_case while keeping idiomatic Java
camelCase parameter names internally.
A possible API would be:
public @interface McpToolParam {
String name() default "";
boolean required() default true;
String description() default "";
}
Since @McpToolParam already targets both PARAMETER and FIELD, the same name attribute could also be honored for
nested object properties in generated schemas.
Expected Behavior
@McpToolParamshould support an optional name attribute to customize the external MCP tool argument name.This should generate an input schema with city_name:
A tool call using
city_nameshould bind to the Java parametercityName.Current Behavior
mcp/mcp-annotations currently uses the Java reflection parameter name for top-level tool input schema properties
and runtime argument binding.
For example:
generates and expects
cityName.There is no MCP-specific way to expose
city_namewhile keeping the Java method parameter namedcityName.Context
I want to expose MCP tool arguments using an external naming style such as snake_case while keeping idiomatic Java
camelCase parameter names internally.
A possible API would be:
Since
@McpToolParamalready targets both PARAMETER and FIELD, the samenameattribute could also be honored fornested object properties in generated schemas.