Stellar1999 commented on issue #15332:
URL: https://github.com/apache/dubbo/issues/15332#issuecomment-2820966818
> Thank you for your proposal! I think adding the `mcp.enabled` attribute in
the `@DubboService` annotation is a good start. However, to better support MCP
functionality, I recommend nesting a `@McpMethod` annotation within
`@DubboService` to describe the method's functionality and parameters. This can
provide more detailed API documentation and reduce the user’s learning curve.
>
> Furthermore, I suggest considering the reuse of OpenAPI annotations like
`@Operation` and `@Parameter`, which would ensure compatibility with existing
OpenAPI documentation generation tools, improving the consistency and
maintainability of the documentation.
>
> @DubboService(mcp = true)
> public class PurchaseOrderServiceImpl implements PurchaseOrderService {
>
> @McpMethod(
> description = "Create a purchase order",
> parameters = {
> @McpParameter(name = "orderId", description = "Unique
identifier for the order"),
> @McpParameter(name = "vendorCode", description = "Vendor
code"),
> @McpParameter(name = "itemDescription", description =
"Description of the item"),
> @McpParameter(name = "price", description = "Order amount"),
> @McpParameter(name = "currency", description = "Currency type")
> }
> )
> public void createPurchaseOrder(String orderId, String vendorCode,
String itemDescription, double price, String currency) {
> // Method implementation
> }
> }
> This approach will not only reduce the user’s cost but also maintain a
well-structured documentation, making it easier for integration with AI systems.
Thank you for your feedback. Based on my understanding of your suggestions,
I will split it into two parts: the first part is to add a new annotation to
identify MCP services, and the second part is to add new OpenAPI-like
annotations to generate new documentation for MCP.
For the first part, I prefer to use the existing annotations because they
better align with Dubbo's specifications and are more easily accepted by users.
If we use a new annotation, considering that this annotation would seem
particularly disconnected from the Dubbo framework and could even exist
independently of Dubbo, I prefer to implement this as an extension rather than
in the main body.
For the second part, my thoughts are similar to yours, but based on the
code, your suggestion is to extend an annotation within @Parameter. I prefer to
directly use annotations like @Parameter, as this would require less
modification and provide a better user experience.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]