Add workflow indexing and improve documentation
- Index business process workflows from BUSINESS_PROCESSES wiki space - Add workflow support to search and help tools - Improve documentation with better organized help content - Add type attributes to seed data files - Enhance error handling for workflow loading
Showing
5 changed files
with
546 additions
and
21 deletions
data/BusinessProcessesData.xml
0 → 100644
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <!-- | ||
| 3 | This software is in the public domain under CC0 1.0 Universal plus a | ||
| 4 | Grant of Patent License. | ||
| 5 | |||
| 6 | To the extent possible under law, the author(s) have dedicated all | ||
| 7 | copyright and related and neighboring rights to this software to the | ||
| 8 | public domain worldwide. This software is distributed without any warranty. | ||
| 9 | |||
| 10 | You should have received a copy of the CC0 Public Domain Dedication | ||
| 11 | along with this software. If not, see | ||
| 12 | <http://creativecommons.org/publicdomain/zero/1.0/>. | ||
| 13 | --> | ||
| 14 | <entity-facade-xml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| 15 | xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/entity-facade-3.xsd" type="seed"> | ||
| 16 | |||
| 17 | <!-- Business Processes Wiki Space --> | ||
| 18 | <moqui.resource.wiki.WikiSpace wikiSpaceId="BUSINESS_PROCESSES" | ||
| 19 | description="Business Process Workflows - Step-by-step guides for common business operations" | ||
| 20 | restrictView="N" | ||
| 21 | restrictUpdate="Y" | ||
| 22 | rootPageLocation="dbresource://WikiSpace/BUSINESS_PROCESSES.md"/> | ||
| 23 | |||
| 24 | <!-- WikiSpace Root Page --> | ||
| 25 | <moqui.resource.DbResource | ||
| 26 | resourceId="WIKI_BUSINESS_PROCESSES" | ||
| 27 | parentResourceId="WIKI_SPACE_ROOT" | ||
| 28 | filename="BUSINESS_PROCESSES.md" | ||
| 29 | isFile="Y"/> | ||
| 30 | <moqui.resource.DbResourceFile | ||
| 31 | resourceId="WIKI_BUSINESS_PROCESSES" | ||
| 32 | mimeType="text/markdown" | ||
| 33 | versionName="v1"> | ||
| 34 | <fileData><**: Create new product variants with proper features, pricing, and associations | ||
| 46 | |||
| 47 | ## How to Use These Guides | ||
| 48 | |||
| 49 | These workflows are designed to be **executable by LLMs**. Each step provides: | ||
| 50 | |||
| 51 | 1. **Exact Tool Call**: The complete `moqui_browse_screens` or `moqui_get_screen_details` call | ||
| 52 | 2. **Parameters**: All required and optional parameters with example values | ||
| 53 | 3. **Expected Result**: What the response looks like and how to extract needed data | ||
| 54 | 4. **Next Step**: How to use the result in the next operation | ||
| 55 | |||
| 56 | Copy the tool calls exactly as shown, replacing example values with your specific data. | ||
| 57 | |||
| 58 | ## Key Concepts | ||
| 59 | |||
| 60 | - **productId vs pseudoId**: Always use internal `productId` (returned from create operations), NOT user-visible `pseudoId` | ||
| 61 | - **Action vs Service**: Use screen `action` parameters, not direct service calls | ||
| 62 | - **Feature Application**: Use `applyProductFeatures` for existing features, `createProductFeature` only for new features | ||
| 63 | - **Variant Associations**: Link variants to virtual parent using `PatVariant` association type | ||
| 64 | |||
| 65 | ## Getting Help | ||
| 66 | |||
| 67 | - Use `moqui_get_screen_details` to see available fields and dropdown options | ||
| 68 | - Use `moqui_get_help` with `wiki:service:EntityName` for service documentation | ||
| 69 | - Check `validationErrors` in action responses for failure reasons]]></fileData> | ||
| 70 | </moqui.resource.DbResourceFile> | ||
| 71 | |||
| 72 | <!-- Root Wiki Page --> | ||
| 73 | <moqui.resource.wiki.WikiPage | ||
| 74 | wikiPageId="BUSINESS_PROCESSES/root" | ||
| 75 | wikiSpaceId="BUSINESS_PROCESSES" | ||
| 76 | pagePath="root" | ||
| 77 | publishedVersionName="v1" | ||
| 78 | restrictView="N"> | ||
| 79 | </moqui.resource.wiki.WikiPage> | ||
| 80 | |||
| 81 | <moqui.resource.wiki.WikiPageHistory | ||
| 82 | wikiPageId="BUSINESS_PROCESSES/root" | ||
| 83 | historySeqId="1" | ||
| 84 | versionName="v1" | ||
| 85 | userId="EX_JOHN_DOE" | ||
| 86 | changeDateTime="2026-01-23 00:00:00.000"/> | ||
| 87 | |||
| 88 | <!-- ========================================== --> | ||
| 89 | <!-- Product Variant Creation Workflow --> | ||
| 90 | <!-- ========================================== --> | ||
| 91 | |||
| 92 | <!-- Product Variant Creation Page --> | ||
| 93 | <moqui.resource.DbResource | ||
| 94 | resourceId="WIKI_BP_PRODUCT_VARIANT" | ||
| 95 | parentResourceId="WIKI_BUSINESS_PROCESSES" | ||
| 96 | filename="Product-Variant-Creation.md" | ||
| 97 | isFile="Y"/> | ||
| 98 | <moqui.resource.DbResourceFile | ||
| 99 | resourceId="WIKI_BP_PRODUCT_VARIANT" | ||
| 100 | mimeType="text/markdown" | ||
| 101 | versionName="v1"> | ||
| 102 | <fileData><![CDATA[# Add Product Variant | ||
| 103 | |||
| 104 | Complete workflow for creating a new product variant with features, pricing, and association to parent. | ||
| 105 | |||
| 106 | ## Prerequisites | ||
| 107 | |||
| 108 | - A virtual parent product exists (e.g., `DEMO_VAR`) | ||
| 109 | - Parent has selectable features defined (e.g., Color, Size options) | ||
| 110 | - You know the feature IDs to apply (e.g., `ColorPurple`, `SizeSmall`) | ||
| 111 | |||
| 112 | ## Overview | ||
| 113 | |||
| 114 | This workflow creates a new variant product by: | ||
| 115 | 1. Finding the parent product | ||
| 116 | 2. Cloning parent to create the variant (or creating a new product) | ||
| 117 | 3. Applying distinguishing features to identify this variant | ||
| 118 | 4. Setting pricing (Current and List prices) | ||
| 119 | 5. Linking variant to virtual parent | ||
| 120 | |||
| 121 | ## Step 1: Find Parent Product | ||
| 122 | |||
| 123 | Locate the virtual parent product to clone from. | ||
| 124 | |||
| 125 | ```bash | ||
| 126 | moqui_browse_screens( | ||
| 127 | path="PopCommerce/PopCommerceAdmin/Catalog/Product/FindProduct", | ||
| 128 | parameters={productId: "DEMO_VAR"} | ||
| 129 | ) | ||
| 130 | ``` | ||
| 131 | |||
| 132 | **Expected Result:** | ||
| 133 | - Product list showing `DEMO_VAR` with its pseudoId | ||
| 134 | - Note the internal `productId` from the response (or use pseudoId for search) | ||
| 135 | - Click product link to navigate to EditProduct screen | ||
| 136 | |||
| 137 | **Next Step:** Use the parent product ID for cloning. | ||
| 138 | |||
| 139 | ## Step 2: Clone Product to Create Variant | ||
| 140 | |||
| 141 | Clone the parent product to create a new variant. This copies features and prices. | ||
| 142 | |||
| 143 | ```bash | ||
| 144 | moqui_browse_screens( | ||
| 145 | path="PopCommerce/PopCommerceAdmin/Catalog/Product/FindProduct", | ||
| 146 | action="cloneProduct", | ||
| 147 | parameters={ | ||
| 148 | productId: "DEMO_VAR", | ||
| 149 | newProductId: "DEMO_VAR_PUR_SM", | ||
| 150 | newProductName: "Demo with Variants Purple Small", | ||
| 151 | copyFeatures: "Y", | ||
| 152 | copyPrices: "Y", | ||
| 153 | copyCategories: "Y", | ||
| 154 | copyAssocs: "N", | ||
| 155 | copyContent: "N", | ||
| 156 | copyInventory: "N", | ||
| 157 | copyFacilities: "N", | ||
| 158 | copyProductStore: "N" | ||
| 159 | } | ||
| 160 | ) | ||
| 161 | ``` | ||
| 162 | |||
| 163 | **Parameters:** | ||
| 164 | - `productId`: Parent product to clone (use pseudoId or internal ID) | ||
| 165 | - `newProductId`: New product's pseudoId (user-visible identifier) | ||
| 166 | - `newProductName`: Display name for the variant | ||
| 167 | - `copyFeatures`: "Y" to copy features from parent | ||
| 168 | - `copyPrices`: "Y" to copy pricing from parent | ||
| 169 | |||
| 170 | **Expected Result:** | ||
| 171 | - Response with `status: "executed"` | ||
| 172 | - `actionResult.result.productId` contains the **internal product ID** of the new variant | ||
| 173 | - Save this `productId` for all subsequent operations | ||
| 174 | |||
| 175 | **Next Step:** Find the new variant product to get its internal `productId`. | ||
| 176 | |||
| 177 | ## Step 3: Find New Variant Product | ||
| 178 | |||
| 179 | Search for the newly created variant to get its internal `productId`. | ||
| 180 | |||
| 181 | ```bash | ||
| 182 | moqui_browse_screens( | ||
| 183 | path="PopCommerce/PopCommerceAdmin/Catalog/Product/FindProduct", | ||
| 184 | parameters={productId: "DEMO_VAR_PUR_SM"} | ||
| 185 | ) | ||
| 186 | ``` | ||
| 187 | |||
| 188 | **Expected Result:** | ||
| 189 | - Product list shows `DEMO_VAR_PUR_SM` | ||
| 190 | - Click product link to navigate to EditProduct | ||
| 191 | - The response includes the `productId` field - **use this internal ID for all next steps** | ||
| 192 | |||
| 193 | **Next Step:** Apply distinguishing features to the variant. | ||
| 194 | |||
| 195 | ## Step 4: Apply Distinguishing Features | ||
| 196 | |||
| 197 | Apply features that make this variant unique (e.g., Purple color, Small size). | ||
| 198 | |||
| 199 | ```bash | ||
| 200 | moqui_browse_screens( | ||
| 201 | path="PopCommerce/PopCommerceAdmin/Catalog/Product/EditProduct", | ||
| 202 | action="applyProductFeatures", | ||
| 203 | parameters={ | ||
| 204 | productId: "100000", | ||
| 205 | productFeatureIdList: ["ColorPurple", "SizeSmall"], | ||
| 206 | applTypeEnumId: "PfatDistinguishing", | ||
| 207 | fromDate: "2026-01-23" | ||
| 208 | } | ||
| 209 | ) | ||
| 210 | ``` | ||
| 211 | |||
| 212 | **Parameters:** | ||
| 213 | - `productId`: **Internal product ID** from Step 3 (NOT the pseudoId!) | ||
| 214 | - `productFeatureIdList`: Array of feature IDs to apply | ||
| 215 | - Must be existing features (use `moqui_get_screen_details` to list available options) | ||
| 216 | - Example: `["ColorPurple", "SizeSmall"]` | ||
| 217 | - `applTypeEnumId`: "PfatDistinguishing" for variants (NOT "PfatSelectable") | ||
| 218 | - `fromDate`: Optional, defaults to current date | ||
| 219 | |||
| 220 | **Expected Result:** | ||
| 221 | - Response with `status: "executed"` | ||
| 222 | - ProductFeatures grid shows the applied features | ||
| 223 | |||
| 224 | **Available Feature Types:** | ||
| 225 | - Colors: `ColorRed`, `ColorBlue`, `ColorGreen`, `ColorPurple`, `ColorBlack`, `ColorWhite` | ||
| 226 | - Sizes: `SizeSmall`, `SizeMedium`, `SizeLarge`, `SizeXL` | ||
| 227 | |||
| 228 | **Next Step:** Set pricing for the variant. | ||
| 229 | |||
| 230 | ## Step 5: Add Current Price | ||
| 231 | |||
| 232 | Set the selling price for the variant. | ||
| 233 | |||
| 234 | ```bash | ||
| 235 | moqui_browse_screens( | ||
| 236 | path="PopCommerce/PopCommerceAdmin/Catalog/Product/EditPrices", | ||
| 237 | action="createProductPrice", | ||
| 238 | parameters={ | ||
| 239 | productId: "100000", | ||
| 240 | priceTypeEnumId: "PptCurrent", | ||
| 241 | pricePurposeEnumId: "PppSales", | ||
| 242 | price: "26.99", | ||
| 243 | priceUomId: "USD", | ||
| 244 | minQuantity: "1", | ||
| 245 | fromDate: "2026-01-23" | ||
| 246 | } | ||
| 247 | ) | ||
| 248 | ``` | ||
| 249 | |||
| 250 | **Parameters:** | ||
| 251 | - `productId`: **Internal product ID** from Step 3 | ||
| 252 | - `priceTypeEnumId`: "PptCurrent" for selling price | ||
| 253 | - `pricePurposeEnumId`: "PppSales" for sales transactions | ||
| 254 | - `price`: Decimal amount (e.g., "26.99") | ||
| 255 | - `priceUomId`: Currency code (default: "USD") | ||
| 256 | - `minQuantity`: Minimum quantity for this price (1 for standard pricing) | ||
| 257 | |||
| 258 | **Expected Result:** | ||
| 259 | - Response with `status: "executed"` | ||
| 260 | - ProductPrice record created | ||
| 261 | |||
| 262 | **Next Step:** Add list price for MSRP display. | ||
| 263 | |||
| 264 | ## Step 6: Add List Price | ||
| 265 | |||
| 266 | Set the list price (MSRP) for the variant. | ||
| 267 | |||
| 268 | ```bash | ||
| 269 | moqui_browse_screens( | ||
| 270 | path="PopCommerce/PopCommerceAdmin/Catalog/Product/EditPrices", | ||
| 271 | action="createProductPrice", | ||
| 272 | parameters={ | ||
| 273 | productId: "100000", | ||
| 274 | priceTypeEnumId: "PptList", | ||
| 275 | pricePurposeEnumId: "PppSales", | ||
| 276 | price: "31.99", | ||
| 277 | priceUomId: "USD", | ||
| 278 | minQuantity: "1", | ||
| 279 | fromDate: "2026-01-23" | ||
| 280 | } | ||
| 281 | ) | ||
| 282 | ``` | ||
| 283 | |||
| 284 | **Parameters:** | ||
| 285 | - `priceTypeEnumId`: "PptList" for list price | ||
| 286 | - All other parameters same as Step 5 | ||
| 287 | |||
| 288 | **Expected Result:** | ||
| 289 | - Response with `status: "executed"` | ||
| 290 | - Variant now has both Current and List prices | ||
| 291 | |||
| 292 | **Next Step:** Link variant to virtual parent. | ||
| 293 | |||
| 294 | ## Step 7: Link Variant to Parent | ||
| 295 | |||
| 296 | Create an association between the variant and the virtual parent product. | ||
| 297 | |||
| 298 | ```bash | ||
| 299 | moqui_browse_screens( | ||
| 300 | path="PopCommerce/PopCommerceAdmin/Catalog/Product/EditAssocs", | ||
| 301 | action="createProductAssoc", | ||
| 302 | parameters={ | ||
| 303 | productId: "DEMO_VAR", | ||
| 304 | toProductId: "100000", | ||
| 305 | productAssocTypeEnumId: "PatVariant", | ||
| 306 | fromDate: "2026-01-23" | ||
| 307 | } | ||
| 308 | ) | ||
| 309 | ``` | ||
| 310 | |||
| 311 | **Parameters:** | ||
| 312 | - `productId`: Parent product pseudoId or internal ID (the virtual product) | ||
| 313 | - `toProductId`: **Internal product ID** of the variant (from Step 3) | ||
| 314 | - `productAssocTypeEnumId`: "PatVariant" for variant relationship | ||
| 315 | - `fromDate`: Optional, defaults to current date | ||
| 316 | |||
| 317 | **Expected Result:** | ||
| 318 | - Response with `status: "executed"` | ||
| 319 | - ProductAssoc record created linking parent to variant | ||
| 320 | |||
| 321 | **Next Step:** Verify the complete setup. | ||
| 322 | |||
| 323 | ## Step 8: Verify Setup | ||
| 324 | |||
| 325 | Verify that the variant is properly configured. | ||
| 326 | |||
| 327 | ```bash | ||
| 328 | moqui_browse_screens( | ||
| 329 | path="PopCommerce/PopCommerceAdmin/Catalog/Product/EditProduct", | ||
| 330 | parameters={productId: "100000"} | ||
| 331 | ) | ||
| 332 | ``` | ||
| 333 | |||
| 334 | **Check:** | ||
| 335 | 1. **Features tab**: Shows `ColorPurple` and `SizeSmall` with `PfatDistinguishing` type | ||
| 336 | 2. **Prices tab**: Shows both Current ($26.99) and List ($31.99) prices | ||
| 337 | 3. **Assocs tab**: Shows association to `DEMO_VAR` with type `PatVariant` | ||
| 338 | |||
| 339 | **Expected Result:** | ||
| 340 | - All features, prices, and associations are visible | ||
| 341 | - Variant is ready for use in catalog | ||
| 342 | |||
| 343 | ## Quick Reference: Common Variant Patterns | ||
| 344 | |||
| 345 | ### Purple Small (Example) | ||
| 346 | - PseudoId: `DEMO_VAR_PUR_SM` | ||
| 347 | - Features: `["ColorPurple", "SizeSmall"]` | ||
| 348 | - Current: $26.99, List: $31.99 | ||
| 349 | |||
| 350 | ### Purple Medium | ||
| 351 | - PseudoId: `DEMO_VAR_PUR_MD` | ||
| 352 | - Features: `["ColorPurple", "SizeMedium"]` | ||
| 353 | - Current: $28.99, List: $33.99 | ||
| 354 | |||
| 355 | ### Purple Large | ||
| 356 | - PseudoId: `DEMO_VAR_PUR_LG` | ||
| 357 | - Features: `["ColorPurple", "SizeLarge"]` | ||
| 358 | - Current: $30.99, List: $35.99 | ||
| 359 | |||
| 360 | ### Purple XL | ||
| 361 | - PseudoId: `DEMO_VAR_PUR_XL` | ||
| 362 | - Features: `["ColorPurple", "SizeXL"]` | ||
| 363 | - Current: $32.99, List: $37.99 | ||
| 364 | |||
| 365 | ## Troubleshooting | ||
| 366 | |||
| 367 | ### Error: "Product already has feature" | ||
| 368 | The feature is already applied. Check existing features and remove or use different features. | ||
| 369 | |||
| 370 | ### Error: "No product found with ID" | ||
| 371 | You're using `pseudoId` instead of internal `productId`. Always use the internal `productId` returned from create operations. | ||
| 372 | |||
| 373 | ### Error: "Invalid productFeatureId" | ||
| 374 | The feature ID doesn't exist. Use `moqui_get_screen_details` on EditProduct to see available features: | ||
| 375 | ```bash | ||
| 376 | moqui_get_screen_details( | ||
| 377 | path="PopCommerce/PopCommerceAdmin/Catalog/Product/EditProduct", | ||
| 378 | fieldName="productFeatureIdList" | ||
| 379 | ) | ||
| 380 | ``` | ||
| 381 | |||
| 382 | ### Variant not showing on parent | ||
| 383 | Check that: | ||
| 384 | 1. `PatVariant` association exists (Step 7) | ||
| 385 | 2. Parent has `PfatSelectable` features for the same feature type | ||
| 386 | 3. Variant has `PfatDistinguishing` features, not `PfatSelectable` | ||
| 387 | |||
| 388 | ### Missing pricing | ||
| 389 | Prices are optional. If not set, the variant will use parent's default pricing or no pricing.]]></fileData> | ||
| 390 | </moqui.resource.DbResourceFile> | ||
| 391 | |||
| 392 | <moqui.resource.wiki.WikiPage | ||
| 393 | wikiPageId="BP/ProductVariant" | ||
| 394 | wikiSpaceId="BUSINESS_PROCESSES" | ||
| 395 | pagePath="Product-Variant-Creation" | ||
| 396 | publishedVersionName="v1" | ||
| 397 | restrictView="N"> | ||
| 398 | </moqui.resource.wiki.WikiPage> | ||
| 399 | |||
| 400 | <moqui.resource.wiki.WikiPageHistory | ||
| 401 | wikiPageId="BP/ProductVariant" | ||
| 402 | historySeqId="1" | ||
| 403 | versionName="v1" | ||
| 404 | userId="EX_JOHN_DOE" | ||
| 405 | changeDateTime="2026-01-23 00:00:00.000"/> | ||
| 406 | |||
| 407 | </entity-facade-xml> |
| ... | @@ -12,7 +12,7 @@ | ... | @@ -12,7 +12,7 @@ |
| 12 | <http://creativecommons.org/publicdomain/zero/1.0/>. | 12 | <http://creativecommons.org/publicdomain/zero/1.0/>. |
| 13 | --> | 13 | --> |
| 14 | <entity-facade-xml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | 14 | <entity-facade-xml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 15 | xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/entity-facade-3.xsd"> | 15 | xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/entity-facade-3.xsd" type="seed"> |
| 16 | 16 | ||
| 17 | <!-- MCP Prompts Wiki Space --> | 17 | <!-- MCP Prompts Wiki Space --> |
| 18 | <moqui.resource.wiki.WikiSpace wikiSpaceId="MCP_PROMPTS" | 18 | <moqui.resource.wiki.WikiSpace wikiSpaceId="MCP_PROMPTS" | ... | ... |
| ... | @@ -12,7 +12,7 @@ | ... | @@ -12,7 +12,7 @@ |
| 12 | <http://creativecommons.org/publicdomain/zero/1.0/>. | 12 | <http://creativecommons.org/publicdomain/zero/1.0/>. |
| 13 | --> | 13 | --> |
| 14 | <entity-facade-xml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | 14 | <entity-facade-xml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 15 | xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/entity-facade-3.xsd"> | 15 | xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/entity-facade-3.xsd" type="seed"> |
| 16 | 16 | ||
| 17 | <!-- MCP Screen Documentation Wiki Space --> | 17 | <!-- MCP Screen Documentation Wiki Space --> |
| 18 | <moqui.resource.wiki.WikiSpace wikiSpaceId="MCP_SCREEN_DOCS" | 18 | <moqui.resource.wiki.WikiSpace wikiSpaceId="MCP_SCREEN_DOCS" |
| ... | @@ -112,17 +112,57 @@ Use the following discovery tools to explore available functionality: | ... | @@ -112,17 +112,57 @@ Use the following discovery tools to explore available functionality: |
| 112 | resourceId="WIKI_MCP_DOCS_ROOT" | 112 | resourceId="WIKI_MCP_DOCS_ROOT" |
| 113 | mimeType="text/markdown" | 113 | mimeType="text/markdown" |
| 114 | versionName="v1"> | 114 | versionName="v1"> |
| 115 | <fileData><![CDATA[# Moqui MCP Server | 115 | <fileData><![CDATA[# Moqui MCP Server |
| 116 | 116 | ||
| 117 | This server provides access to Moqui ERP through MCP. Typically you will be searching for a product by name or by a feature like size or color. | 117 | This server provides access to Moqui ERP through MCP. Use the following tools to discover functionality and get help with common tasks. |
| 118 | If it is a feature based query it is probably best to use the FindFeature screen to locate the feature and then use FindProduct to search for products with that feature. | ||
| 119 | 118 | ||
| 120 | ## Getting Started | 119 | ## Help & Discovery Tools |
| 121 | 120 | ||
| 122 | Use the following discovery tools to explore available functionality: | 121 | Use these tools to find information: |
| 123 | - `moqui_browse_screens`: Browse Moqui screen hierarchy | 122 | |
| 124 | - `moqui_search_screens`: Search for screens by name to find their paths | 123 | - **`moqui_search_screens`**: Search for screens and workflows by name |
| 125 | - `moqui_get_screen_details`: Get input parameters for specific screens | 124 | - Example: `moqui_search_screens(query="variant")` finds the Product Variant Creation workflow |
| 125 | - Returns both screens and business process workflows | ||
| 126 | |||
| 127 | - **`moqui_browse_screens`**: Browse Moqui screen hierarchy | ||
| 128 | - Use empty path for root: `moqui_browse_screens(path="")` | ||
| 129 | - Navigate deep: `moqui_browse_screens(path="PopCommerce/Catalog/Product/FindProduct")` | ||
| 130 | - Execute actions: `moqui_browse_screens(path="...", action="createProduct", parameters={...})` | ||
| 131 | |||
| 132 | - **`moqui_get_screen_details`**: Get dropdown options and field details | ||
| 133 | - Use before submitting forms to understand available options | ||
| 134 | - Example: `moqui_get_screen_details(path="PopCommerce/Party/EditParty", fieldName="countryGeoId")` | ||
| 135 | |||
| 136 | - **`moqui_get_help`**: Get extended documentation | ||
| 137 | - Screen help: `moqui_get_help(uri="wiki:screen:EditProduct")` | ||
| 138 | - Service help: `moqui_get_help(uri="wiki:service:Product")` | ||
| 139 | - **Workflow help**: `moqui_get_help(uri="wiki:workflow:Product-Variant-Creation")` | ||
| 140 | |||
| 141 | ## Business Process Workflows | ||
| 142 | |||
| 143 | Complex multi-step operations are documented as workflows. Use `moqui_search_screens` to find them: | ||
| 144 | |||
| 145 | **Example: Creating a Product Variant** | ||
| 146 | |||
| 147 | 1. Search for variant workflow: | ||
| 148 | ``` | ||
| 149 | moqui_search_screens(query="variant") | ||
| 150 | ``` | ||
| 151 | Returns: `{"path": "wiki:workflow:Product-Variant-Creation", ...}` | ||
| 152 | |||
| 153 | 2. Get workflow documentation: | ||
| 154 | ``` | ||
| 155 | moqui_get_help(uri="wiki:workflow:Product-Variant-Creation") | ||
| 156 | ``` | ||
| 157 | Returns: Complete 8-step guide with exact tool calls and parameters | ||
| 158 | |||
| 159 | 3. Execute each step using the provided tool calls: | ||
| 160 | - Clone parent product | ||
| 161 | - Apply distinguishing features (e.g., ColorPurple, SizeSmall) | ||
| 162 | - Set pricing (Current and List prices) | ||
| 163 | - Link variant to virtual parent | ||
| 164 | |||
| 165 | The workflow documentation includes exact tool calls, expected responses, and troubleshooting guidance. | ||
| 126 | 166 | ||
| 127 | ## Common Screen Paths | 167 | ## Common Screen Paths |
| 128 | 168 | ||
| ... | @@ -148,15 +188,16 @@ Use the following discovery tools to explore available functionality: | ... | @@ -148,15 +188,16 @@ Use the following discovery tools to explore available functionality: |
| 148 | 188 | ||
| 149 | ### System & Developer Tools | 189 | ### System & Developer Tools |
| 150 | - `/tools/Tools`: Developer tools, entity data editing, and service references | 190 | - `/tools/Tools`: Developer tools, entity data editing, and service references |
| 151 | - `/tools/System`: System administration, cache management, and security settings | ||
| 152 | 191 | ||
| 153 | ## Tips for LLM Clients | 192 | ## Tips for LLM Clients |
| 154 | 193 | ||
| 155 | - All screens support parameterized queries for filtering results | 194 | - **Actions are NOT services** - Use screen actions, not direct service calls |
| 156 | - Use `moqui_render_screen` with screen path to execute screens | 195 | - **Use exact parameter names** - Tool calls in workflows use precise field names |
| 157 | - Screen paths use forward slash notation (e.g., `/PopCommerce/PopCommerceAdmin/Catalog/Product`) | 196 | - **Extract IDs from responses** - Create operations return internal IDs (not pseudoIds) for use in subsequent steps |
| 158 | - Check `moqui_get_screen_details` for required parameters before rendering | 197 | - **Check dropdown options** - Use `moqui_get_screen_details` to see valid values before submitting |
| 159 | - Use `renderMode: "mcp"` for structured JSON output or `"text"` for human-readable format]]></fileData> | 198 | - **Use `renderMode: "compact"`** for efficient structured output |
| 199 | - **Check validation errors** - Action responses include `validationErrors` with field-specific messages | ||
| 200 | - **Read `help` fields** - Actions include `help` URIs (e.g., `wiki:service:ProductAssoc`) for detailed documentation]]></fileData> | ||
| 160 | </moqui.resource.DbResourceFile> | 201 | </moqui.resource.DbResourceFile> |
| 161 | 202 | ||
| 162 | <!-- PopCommerce Root Screen Documentation --> | 203 | <!-- PopCommerce Root Screen Documentation --> | ... | ... |
| ... | @@ -11,7 +11,7 @@ | ... | @@ -11,7 +11,7 @@ |
| 11 | <https://creativecommons.org/publicdomain/zero/1.0/>. --> | 11 | <https://creativecommons.org/publicdomain/zero/1.0/>. --> |
| 12 | 12 | ||
| 13 | <entity-facade-xml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | 13 | <entity-facade-xml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 14 | xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/entity-facade-3.xsd"> | 14 | xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/entity-facade-3.xsd" type="seed-initial"> |
| 15 | 15 | ||
| 16 | <!-- MCP User Groups --> | 16 | <!-- MCP User Groups --> |
| 17 | <moqui.security.UserGroup userGroupId="McpUser" description="MCP Server Users"/> | 17 | <moqui.security.UserGroup userGroupId="McpUser" description="MCP Server Users"/> | ... | ... |
| ... | @@ -2837,7 +2837,67 @@ def wikiInstructions = getWikiInstructions(inputScreenPath) | ... | @@ -2837,7 +2837,67 @@ def wikiInstructions = getWikiInstructions(inputScreenPath) |
| 2837 | if (webrootSd) { | 2837 | if (webrootSd) { |
| 2838 | walkScreenTree(webrootSd, "", 0) | 2838 | walkScreenTree(webrootSd, "", 0) |
| 2839 | } | 2839 | } |
| 2840 | 2840 | ||
| 2841 | // Index workflows from BUSINESS_PROCESSES wiki space | ||
| 2842 | try { | ||
| 2843 | ec.artifactExecution.disableAuthz() | ||
| 2844 | def workflowPageList = ec.entity.find("moqui.resource.wiki.WikiPage") | ||
| 2845 | .condition("wikiSpaceId", "BUSINESS_PROCESSES") | ||
| 2846 | .list() | ||
| 2847 | |||
| 2848 | for (def wp in workflowPageList) { | ||
| 2849 | // Skip root page | ||
| 2850 | if (wp.pagePath == "root") continue | ||
| 2851 | def title = wp.pagePath | ||
| 2852 | def description = "" | ||
| 2853 | |||
| 2854 | try { | ||
| 2855 | def dbResource = ec.entity.find("moqui.resource.DbResource") | ||
| 2856 | .condition("parentResourceId", "WIKI_BUSINESS_PROCESSES") | ||
| 2857 | .condition("filename", wp.pagePath + ".md") | ||
| 2858 | .one() | ||
| 2859 | |||
| 2860 | if (dbResource) { | ||
| 2861 | def dbResourceFile = ec.entity.find("moqui.resource.DbResourceFile") | ||
| 2862 | .condition("resourceId", dbResource.resourceId) | ||
| 2863 | .one() | ||
| 2864 | |||
| 2865 | if (dbResourceFile && dbResourceFile.fileData) { | ||
| 2866 | def content = new String(dbResourceFile.fileData.getBytes(1L, dbResourceFile.fileData.length() as int), "UTF-8") | ||
| 2867 | |||
| 2868 | // Extract title from first heading | ||
| 2869 | def titleMatch = content =~ /^#\s+(.+)$/ | ||
| 2870 | if (titleMatch.find()) { | ||
| 2871 | title = titleMatch.group(1) | ||
| 2872 | } | ||
| 2873 | |||
| 2874 | // Extract first paragraph as description | ||
| 2875 | def lines = content.split('\n') | ||
| 2876 | for (line in lines) { | ||
| 2877 | line = line.trim() | ||
| 2878 | if (line && !line.startsWith('#')) { | ||
| 2879 | description = line.take(200) | ||
| 2880 | break | ||
| 2881 | } | ||
| 2882 | } | ||
| 2883 | } | ||
| 2884 | } | ||
| 2885 | } catch (Exception e) { | ||
| 2886 | ec.logger.debug("SearchScreens: Error loading workflow ${wp.pagePath}: ${e.message}") | ||
| 2887 | } | ||
| 2888 | |||
| 2889 | screenIndex << [ | ||
| 2890 | path: "wiki:workflow:${wp.pagePath}", | ||
| 2891 | name: title, | ||
| 2892 | description: description, | ||
| 2893 | type: "workflow" | ||
| 2894 | ] | ||
| 2895 | } | ||
| 2896 | ec.logger.info("SearchScreens: Indexed ${workflowPageList.size()} workflows") | ||
| 2897 | } catch (Exception e) { | ||
| 2898 | ec.logger.warn("SearchScreens: Error indexing workflows: ${e.message}") | ||
| 2899 | } | ||
| 2900 | |||
| 2841 | // Cache the index | 2901 | // Cache the index |
| 2842 | mcpCache.put(cacheKey, screenIndex) | 2902 | mcpCache.put(cacheKey, screenIndex) |
| 2843 | ec.logger.info("SearchScreens: Built index with ${screenIndex.size()} screens") | 2903 | ec.logger.info("SearchScreens: Built index with ${screenIndex.size()} screens") |
| ... | @@ -2875,8 +2935,11 @@ def wikiInstructions = getWikiInstructions(inputScreenPath) | ... | @@ -2875,8 +2935,11 @@ def wikiInstructions = getWikiInstructions(inputScreenPath) |
| 2875 | } | 2935 | } |
| 2876 | 2936 | ||
| 2877 | // Prefer shallower screens (more likely to be entry points) | 2937 | // Prefer shallower screens (more likely to be entry points) |
| 2938 | // Workflows have no depth penalty | ||
| 2878 | if (score > 0) { | 2939 | if (score > 0) { |
| 2879 | score -= (screen.depth ?: 0) * 2 | 2940 | if (screen.type != "workflow") { |
| 2941 | score -= (screen.depth ?: 0) * 2 | ||
| 2942 | } | ||
| 2880 | scored << [screen: screen, score: score] | 2943 | scored << [screen: screen, score: score] |
| 2881 | } | 2944 | } |
| 2882 | } | 2945 | } |
| ... | @@ -2896,7 +2959,7 @@ def wikiInstructions = getWikiInstructions(inputScreenPath) | ... | @@ -2896,7 +2959,7 @@ def wikiInstructions = getWikiInstructions(inputScreenPath) |
| 2896 | // Add hint if no matches | 2959 | // Add hint if no matches |
| 2897 | def hint = null | 2960 | def hint = null |
| 2898 | if (matches.isEmpty()) { | 2961 | if (matches.isEmpty()) { |
| 2899 | hint = "No screens found matching '${query}'. Try broader terms like 'product', 'order', 'party', or use moqui_browse_screens to explore." | 2962 | hint = "No screens or workflows found matching '${query}'. Try broader terms like 'product', 'order', 'party', or use moqui_browse_screens to explore." |
| 2900 | } else if (matches.size() >= 15) { | 2963 | } else if (matches.size() >= 15) { |
| 2901 | hint = "Showing top 15 results. Refine your search for more specific matches." | 2964 | hint = "Showing top 15 results. Refine your search for more specific matches." |
| 2902 | } | 2965 | } |
| ... | @@ -3084,6 +3147,10 @@ def wikiInstructions = getWikiInstructions(inputScreenPath) | ... | @@ -3084,6 +3147,10 @@ def wikiInstructions = getWikiInstructions(inputScreenPath) |
| 3084 | wikiSpaceId = "MCP_SERVICE_DOCS" | 3147 | wikiSpaceId = "MCP_SERVICE_DOCS" |
| 3085 | pagePath = pageName | 3148 | pagePath = pageName |
| 3086 | break | 3149 | break |
| 3150 | case "workflow": | ||
| 3151 | wikiSpaceId = "BUSINESS_PROCESSES" | ||
| 3152 | pagePath = pageName | ||
| 3153 | break | ||
| 3087 | default: | 3154 | default: |
| 3088 | wikiSpaceId = "MCP_SCREEN_DOCS" | 3155 | wikiSpaceId = "MCP_SCREEN_DOCS" |
| 3089 | pagePath = pageName | 3156 | pagePath = pageName |
| ... | @@ -3107,7 +3174,17 @@ def wikiInstructions = getWikiInstructions(inputScreenPath) | ... | @@ -3107,7 +3174,17 @@ def wikiInstructions = getWikiInstructions(inputScreenPath) |
| 3107 | 3174 | ||
| 3108 | if (wikiPage) { | 3175 | if (wikiPage) { |
| 3109 | // Use direct DbResource/DbResourceFile lookup (like BrowseScreens does) | 3176 | // Use direct DbResource/DbResourceFile lookup (like BrowseScreens does) |
| 3110 | def parentResourceId = (wikiType == "service") ? "WIKI_MCP_SERVICE_DOCS" : "WIKI_MCP_SCREEN_DOCS" | 3177 | def parentResourceId |
| 3178 | switch (wikiType) { | ||
| 3179 | case "workflow": | ||
| 3180 | parentResourceId = "WIKI_BUSINESS_PROCESSES" | ||
| 3181 | break | ||
| 3182 | case "service": | ||
| 3183 | parentResourceId = "WIKI_MCP_SERVICE_DOCS" | ||
| 3184 | break | ||
| 3185 | default: | ||
| 3186 | parentResourceId = "WIKI_MCP_SCREEN_DOCS" | ||
| 3187 | } | ||
| 3111 | 3188 | ||
| 3112 | def dbResource = ec.entity.find("moqui.resource.DbResource") | 3189 | def dbResource = ec.entity.find("moqui.resource.DbResource") |
| 3113 | .condition("parentResourceId", parentResourceId) | 3190 | .condition("parentResourceId", parentResourceId) | ... | ... |
-
Please register or sign in to post a comment