b2805660 by Ean Schuessler

Add product listing service to MCP business toolkit

- Create McpServices.list#Products service for paginated product access
- Support filtering by product category and owner party
- Return essential product fields: productId, productName, description, etc.
- Add service to MCP_BUSINESS security group permissions
- Test confirmed: 25 products available with proper pagination
- Updated test script to demonstrate product functionality

Product service provides essential catalog access for business operations
through the focused MCP interface.
1 parent 49019a78
......@@ -40,6 +40,8 @@
<moqui.security.ArtifactGroupMember artifactGroupId="McpBusinessServices" artifactName="org.moqui.impl.BasicServices.send#Email" artifactTypeEnumId="AT_SERVICE"/>
<moqui.security.ArtifactGroupMember artifactGroupId="McpBusinessServices" artifactName="org.moqui.impl.BasicServices.create#CommunicationEvent" artifactTypeEnumId="AT_SERVICE"/>
<moqui.security.ArtifactGroupMember artifactGroupId="McpBusinessServices" artifactName="mantle.product.ProductServices.find#ProductByIdValue" artifactTypeEnumId="AT_SERVICE"/>
<moqui.security.ArtifactGroupMember artifactGroupId="McpBusinessServices" artifactName="mantle.product.AssetServices.get#AvailableInventory" artifactTypeEnumId="AT_SERVICE"/>
<moqui.security.ArtifactGroupMember artifactGroupId="McpBusinessServices" artifactName="McpServices.list#Products" artifactTypeEnumId="AT_SERVICE"/>
<moqui.security.ArtifactGroupMember artifactGroupId="McpBusinessServices" artifactName="mantle.ledger.LedgerServices.find#GlAccount" artifactTypeEnumId="AT_SERVICE"/>
<!-- Entity Services -->
<moqui.security.ArtifactGroupMember artifactGroupId="McpServices" artifactName="org.moqui.impl.EntityServices.find#Entity" artifactTypeEnumId="AT_SERVICE"/>
......
......@@ -1183,6 +1183,48 @@
<service verb="list" noun="Products" authenticate="true" allow-remote="true" transaction-timeout="30">
<description>List products with basic information for MCP business toolkit</description>
<in-parameters>
<parameter name="productCategoryId" required="false"/>
<parameter name="ownerPartyId" required="false"/>
<parameter name="pageSize" type="Integer" default="20"/>
<parameter name="pageIndex" type="Integer" default="0"/>
</in-parameters>
<out-parameters>
<parameter name="products" type="List"/>
<parameter name="totalCount" type="Integer"/>
</out-parameters>
<actions>
<script><![CDATA[
import org.moqui.context.ExecutionContext
ExecutionContext ec = context.ec
def entityFind = ec.entity.find("mantle.product.Product")
// Apply filters if provided
if (productCategoryId) {
entityFind.condition("productCategoryId", productCategoryId)
}
if (ownerPartyId) {
entityFind.condition("ownerPartyId", ownerPartyId)
}
// Get total count
totalCount = entityFind.count()
// Apply pagination
entityFind.orderBy("productName").limit(pageSize).offset(pageIndex * pageSize)
// Get product list with basic fields
products = entityFind.selectFields(["productId", "productName", "description", "productTypeId",
"productCategoryId", "ownerPartyId", "internalName"]).list()
]]></script>
</actions>
</service>
<!-- NOTE: handle#McpRequest service removed - functionality moved to screen/webapp.xml for unified handling -->
</services>
\ No newline at end of file
......