Skip to content

Pluggable Java-method tool-definition strategies & typed inputSchema in MCP #3317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
andrey-fomin opened this issue May 24, 2025 · 0 comments

Comments

@andrey-fomin
Copy link

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 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:

  1. 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.
  2. 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!

@andrey-fomin 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 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant