You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’ve tried to expose the REST methods of my application using MCP, but I haven’t
found an easy way to do so. I’d like to leverage Swagger v3 annotations for
tool definitions, but MethodToolCallbackProvider doesn’t support this
approach. The main issues are:
Only @Tool annotations are considered. There’s no way to plug in an
alternative strategy for creating tool definitions.
Parameter names are extracted from the bytecode. Without the -parameters
compiler flag, descriptive names aren’t available.
I propose the following enhancements:
Allow injection of alternative strategies for generating tool definitions
from different kinds of method metadata. The strategy based on @Tool annotations could remain one of the built-in options.
Introduce a clear mapping between tool-definition parameter names and the
original Java method parameters.
Moreover, implementing this parameter mapping would be much simpler if ToolDefinition.inputSchema were a typed object (as defined in the MCP specification)
instead of a raw JSON string. This would allow implementations to assume that
parameters in the tool definition appear in the same order as in the bytecode.
Would it be feasible to introduce these backward-incompatible changes to ToolDefinition, MethodToolCallbackProvider, and MethodToolCallback?
Thanks!
The text was updated successfully, but these errors were encountered:
andrey-fomin
changed the title
Make tool definitions more genaric
Enable pluggable tool-definition strategies and typed inputSchema in MCP
May 24, 2025
andrey-fomin
changed the title
Enable pluggable tool-definition strategies and typed inputSchema in MCP
Pluggable Java-method tool-definition strategies & typed inputSchema in MCP
May 24, 2025
Hi @ThomasVitale,
I’ve tried to expose the REST methods of my application using MCP, but I haven’t
found an easy way to do so. I’d like to leverage Swagger v3 annotations for
tool definitions, but
MethodToolCallbackProvider
doesn’t support thisapproach. The main issues are:
@Tool
annotations are considered. There’s no way to plug in analternative strategy for creating tool definitions.
-parameters
compiler flag, descriptive names aren’t available.
I propose the following enhancements:
from different kinds of method metadata. The strategy based on
@Tool
annotations could remain one of the built-in options.original Java method parameters.
Moreover, implementing this parameter mapping would be much simpler if
ToolDefinition.inputSchema
were a typed object (as defined in theMCP specification)
instead of a raw JSON string. This would allow implementations to assume that
parameters in the tool definition appear in the same order as in the bytecode.
Would it be feasible to introduce these backward-incompatible changes to
ToolDefinition
,MethodToolCallbackProvider
, andMethodToolCallback
?Thanks!
The text was updated successfully, but these errors were encountered: