heliang666s commented on issue #15332:
URL: https://github.com/apache/dubbo/issues/15332#issuecomment-2820579491
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.
```java
@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.
--
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]