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.
Showing
2 changed files
with
44 additions
and
0 deletions
| ... | @@ -40,6 +40,8 @@ | ... | @@ -40,6 +40,8 @@ |
| 40 | <moqui.security.ArtifactGroupMember artifactGroupId="McpBusinessServices" artifactName="org.moqui.impl.BasicServices.send#Email" artifactTypeEnumId="AT_SERVICE"/> | 40 | <moqui.security.ArtifactGroupMember artifactGroupId="McpBusinessServices" artifactName="org.moqui.impl.BasicServices.send#Email" artifactTypeEnumId="AT_SERVICE"/> |
| 41 | <moqui.security.ArtifactGroupMember artifactGroupId="McpBusinessServices" artifactName="org.moqui.impl.BasicServices.create#CommunicationEvent" artifactTypeEnumId="AT_SERVICE"/> | 41 | <moqui.security.ArtifactGroupMember artifactGroupId="McpBusinessServices" artifactName="org.moqui.impl.BasicServices.create#CommunicationEvent" artifactTypeEnumId="AT_SERVICE"/> |
| 42 | <moqui.security.ArtifactGroupMember artifactGroupId="McpBusinessServices" artifactName="mantle.product.ProductServices.find#ProductByIdValue" artifactTypeEnumId="AT_SERVICE"/> | 42 | <moqui.security.ArtifactGroupMember artifactGroupId="McpBusinessServices" artifactName="mantle.product.ProductServices.find#ProductByIdValue" artifactTypeEnumId="AT_SERVICE"/> |
| 43 | <moqui.security.ArtifactGroupMember artifactGroupId="McpBusinessServices" artifactName="mantle.product.AssetServices.get#AvailableInventory" artifactTypeEnumId="AT_SERVICE"/> | ||
| 44 | <moqui.security.ArtifactGroupMember artifactGroupId="McpBusinessServices" artifactName="McpServices.list#Products" artifactTypeEnumId="AT_SERVICE"/> | ||
| 43 | <moqui.security.ArtifactGroupMember artifactGroupId="McpBusinessServices" artifactName="mantle.ledger.LedgerServices.find#GlAccount" artifactTypeEnumId="AT_SERVICE"/> | 45 | <moqui.security.ArtifactGroupMember artifactGroupId="McpBusinessServices" artifactName="mantle.ledger.LedgerServices.find#GlAccount" artifactTypeEnumId="AT_SERVICE"/> |
| 44 | <!-- Entity Services --> | 46 | <!-- Entity Services --> |
| 45 | <moqui.security.ArtifactGroupMember artifactGroupId="McpServices" artifactName="org.moqui.impl.EntityServices.find#Entity" artifactTypeEnumId="AT_SERVICE"/> | 47 | <moqui.security.ArtifactGroupMember artifactGroupId="McpServices" artifactName="org.moqui.impl.EntityServices.find#Entity" artifactTypeEnumId="AT_SERVICE"/> | ... | ... |
| ... | @@ -1183,6 +1183,48 @@ | ... | @@ -1183,6 +1183,48 @@ |
| 1183 | 1183 | ||
| 1184 | 1184 | ||
| 1185 | 1185 | ||
| 1186 | <service verb="list" noun="Products" authenticate="true" allow-remote="true" transaction-timeout="30"> | ||
| 1187 | <description>List products with basic information for MCP business toolkit</description> | ||
| 1188 | <in-parameters> | ||
| 1189 | <parameter name="productCategoryId" required="false"/> | ||
| 1190 | <parameter name="ownerPartyId" required="false"/> | ||
| 1191 | <parameter name="pageSize" type="Integer" default="20"/> | ||
| 1192 | <parameter name="pageIndex" type="Integer" default="0"/> | ||
| 1193 | </in-parameters> | ||
| 1194 | <out-parameters> | ||
| 1195 | <parameter name="products" type="List"/> | ||
| 1196 | <parameter name="totalCount" type="Integer"/> | ||
| 1197 | </out-parameters> | ||
| 1198 | <actions> | ||
| 1199 | <script><![CDATA[ | ||
| 1200 | import org.moqui.context.ExecutionContext | ||
| 1201 | |||
| 1202 | ExecutionContext ec = context.ec | ||
| 1203 | |||
| 1204 | def entityFind = ec.entity.find("mantle.product.Product") | ||
| 1205 | |||
| 1206 | // Apply filters if provided | ||
| 1207 | if (productCategoryId) { | ||
| 1208 | entityFind.condition("productCategoryId", productCategoryId) | ||
| 1209 | } | ||
| 1210 | if (ownerPartyId) { | ||
| 1211 | entityFind.condition("ownerPartyId", ownerPartyId) | ||
| 1212 | } | ||
| 1213 | |||
| 1214 | // Get total count | ||
| 1215 | totalCount = entityFind.count() | ||
| 1216 | |||
| 1217 | // Apply pagination | ||
| 1218 | entityFind.orderBy("productName").limit(pageSize).offset(pageIndex * pageSize) | ||
| 1219 | |||
| 1220 | // Get product list with basic fields | ||
| 1221 | products = entityFind.selectFields(["productId", "productName", "description", "productTypeId", | ||
| 1222 | "productCategoryId", "ownerPartyId", "internalName"]).list() | ||
| 1223 | |||
| 1224 | ]]></script> | ||
| 1225 | </actions> | ||
| 1226 | </service> | ||
| 1227 | |||
| 1186 | <!-- NOTE: handle#McpRequest service removed - functionality moved to screen/webapp.xml for unified handling --> | 1228 | <!-- NOTE: handle#McpRequest service removed - functionality moved to screen/webapp.xml for unified handling --> |
| 1187 | 1229 | ||
| 1188 | </services> | 1230 | </services> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment