@wowok/agent-mcp 2.6.1 → 2.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/dist/customer/customer-advice.d.ts +31 -0
  2. package/dist/customer/customer-advice.js +129 -0
  3. package/dist/customer/index.d.ts +2 -0
  4. package/dist/customer/index.js +2 -0
  5. package/dist/customer/info-puzzle.d.ts +9 -2
  6. package/dist/customer/info-puzzle.js +34 -7
  7. package/dist/customer/order-monitor.d.ts +2 -0
  8. package/dist/customer/order-monitor.js +3 -2
  9. package/dist/customer/post-purchase.d.ts +2 -0
  10. package/dist/customer/post-purchase.js +6 -5
  11. package/dist/customer/preorder-compare.d.ts +24 -0
  12. package/dist/customer/preorder-compare.js +34 -0
  13. package/dist/customer/reminder-system.d.ts +2 -0
  14. package/dist/customer/reminder-system.js +2 -1
  15. package/dist/customer/risk-assessment.js +30 -7
  16. package/dist/customer/types.d.ts +7 -0
  17. package/dist/examples/arbitration-dispute-create.json +41 -0
  18. package/dist/examples/arbitration-vote-weighted.json +35 -0
  19. package/dist/examples/arbitration-voting-guard-add.json +38 -0
  20. package/dist/examples/demand-present-service.json +33 -0
  21. package/dist/examples/gen-passport-verify-guard.json +48 -0
  22. package/dist/examples/guard-template-balance-check.json +59 -0
  23. package/dist/examples/guard-template-time-lock.json +60 -0
  24. package/dist/examples/insurance-guard-claim-timelock.json +75 -0
  25. package/dist/examples/insurance-guard-withdraw-allocation.json +96 -0
  26. package/dist/examples/insurance-machine-create-publish.json +75 -0
  27. package/dist/examples/insurance-service-allocators-publish.json +56 -0
  28. package/dist/examples/machine-multisig-threshold.json +86 -0
  29. package/dist/examples/machine-template-7node-rental.json +119 -0
  30. package/dist/examples/payment-scenario-bound.json +45 -0
  31. package/dist/examples/rental-ziroom-machine-create.json +149 -0
  32. package/dist/examples/rental-ziroom-permission-create.json +42 -0
  33. package/dist/examples/rental-ziroom-service-create.json +89 -0
  34. package/dist/examples/retail-adv-guard-customer-win-create.json +80 -0
  35. package/dist/examples/retail-adv-guard-messenger-proof-create.json +65 -0
  36. package/dist/examples/retail-adv-guard-reward-timeout-create.json +92 -0
  37. package/dist/examples/retail-adv-reward-guard-add.json +51 -0
  38. package/dist/examples/retail-myshop-allocation-activate.json +55 -0
  39. package/dist/examples/retail-myshop-arbitration-create.json +40 -0
  40. package/dist/examples/retail-myshop-contact-create.json +43 -0
  41. package/dist/examples/retail-myshop-order-create.json +56 -0
  42. package/dist/examples/retail-myshop-progress-operate.json +38 -0
  43. package/dist/examples/retail-myshop-reward-create.json +35 -0
  44. package/dist/examples/retail-myshop-service-create.json +88 -0
  45. package/dist/examples/service-discount-issue.json +46 -0
  46. package/dist/examples/threebody-guard-create.json +56 -0
  47. package/dist/examples/threebody-machine-create.json +72 -0
  48. package/dist/examples/threebody-permission-create.json +38 -0
  49. package/dist/examples/threebody-service-allocators.json +49 -0
  50. package/dist/examples/travel-guard-time-lock.json +69 -0
  51. package/dist/examples/travel-guard-weather-oracle.json +70 -0
  52. package/dist/examples/travel-machine-create.json +136 -0
  53. package/dist/examples/travel-repository-create.json +47 -0
  54. package/dist/examples/travel-service-create.json +102 -0
  55. package/dist/examples/travel-treasury-create.json +34 -0
  56. package/dist/examples/treasury-deposit.json +37 -0
  57. package/dist/examples/treasury-withdraw.json +38 -0
  58. package/dist/extensions/business-modules.d.ts +49 -0
  59. package/dist/extensions/business-modules.js +287 -0
  60. package/dist/extensions/capability-manifest.js +216 -29
  61. package/dist/extensions/constraint-registry.js +21 -19
  62. package/dist/extensions/metric-registry.js +14 -14
  63. package/dist/extensions/mode-evaluator.js +16 -16
  64. package/dist/extensions/modes.js +141 -49
  65. package/dist/extensions/registry.d.ts +16 -9
  66. package/dist/extensions/registry.js +132 -44
  67. package/dist/extensions/types.d.ts +2 -0
  68. package/dist/index.js +50 -0
  69. package/dist/knowledge/deployment-scanner.js +1 -1
  70. package/dist/knowledge/fund-layer.d.ts +138 -0
  71. package/dist/knowledge/fund-layer.js +969 -0
  72. package/dist/knowledge/guard-render.d.ts +57 -0
  73. package/dist/knowledge/guard-render.js +700 -0
  74. package/dist/knowledge/guard-submission-prompt.d.ts +31 -0
  75. package/dist/knowledge/guard-submission-prompt.js +171 -0
  76. package/dist/knowledge/guard-templates.d.ts +10 -0
  77. package/dist/knowledge/guard-templates.js +50 -0
  78. package/dist/knowledge/index.d.ts +2 -2
  79. package/dist/knowledge/index.js +2 -2
  80. package/dist/knowledge/machine-ledger.js +1 -1
  81. package/dist/knowledge/machine-render.d.ts +41 -0
  82. package/dist/knowledge/machine-render.js +565 -0
  83. package/dist/knowledge/machine-risk.js +4 -1
  84. package/dist/knowledge/machine-templates.js +4 -4
  85. package/dist/knowledge/progress-context.js +1 -1
  86. package/dist/knowledge/progress-ledger.js +3 -3
  87. package/dist/knowledge/progress-templates.js +1 -1
  88. package/dist/knowledge/progress-translation.js +1 -1
  89. package/dist/knowledge/reward-confirm.js +2 -2
  90. package/dist/knowledge/reward-puzzle.js +1 -1
  91. package/dist/knowledge/reward-risk.js +9 -9
  92. package/dist/knowledge/reward-templates.js +2 -2
  93. package/dist/knowledge/safety-rules.d.ts +83 -1
  94. package/dist/knowledge/safety-rules.js +166 -2
  95. package/dist/knowledge/scenario-modes.d.ts +1 -1
  96. package/dist/knowledge/scenario-modes.js +13 -11
  97. package/dist/knowledge/service-confirm.d.ts +1 -1
  98. package/dist/knowledge/service-confirm.js +3 -3
  99. package/dist/knowledge/service-context.js +1 -1
  100. package/dist/knowledge/service-ledger.js +1 -1
  101. package/dist/knowledge/service-risk.d.ts +1 -1
  102. package/dist/knowledge/service-risk.js +3 -3
  103. package/dist/knowledge/service-templates.js +2 -2
  104. package/dist/knowledge/service-translation.d.ts +1 -1
  105. package/dist/knowledge/service-translation.js +7 -7
  106. package/dist/knowledge/template-registry.d.ts +48 -0
  107. package/dist/knowledge/template-registry.js +341 -0
  108. package/dist/knowledge/tool-constraints.js +6 -6
  109. package/dist/knowledge/tools-reference.js +11 -8
  110. package/dist/participation/merchant-interest.d.ts +32 -0
  111. package/dist/participation/merchant-interest.js +100 -0
  112. package/dist/participation/radar-core.d.ts +104 -0
  113. package/dist/participation/radar-core.js +269 -0
  114. package/dist/project/context-assembly.js +8 -0
  115. package/dist/project/deployment-bridge.js +6 -5
  116. package/dist/project/deployment-doc.js +5 -5
  117. package/dist/project/edit-planner.d.ts +123 -0
  118. package/dist/project/edit-planner.js +1342 -0
  119. package/dist/project/evaluation.d.ts +36 -0
  120. package/dist/project/evaluation.js +734 -68
  121. package/dist/project/game-theory.d.ts +43 -0
  122. package/dist/project/game-theory.js +177 -0
  123. package/dist/project/graph-builder.js +7 -1
  124. package/dist/project/handlers.d.ts +137 -2
  125. package/dist/project/handlers.js +423 -51
  126. package/dist/project/intent-analyzer.d.ts +71 -0
  127. package/dist/project/intent-analyzer.js +149 -0
  128. package/dist/project/machine-nodes.d.ts +2 -0
  129. package/dist/project/machine-nodes.js +36 -0
  130. package/dist/project/merchant-guide.d.ts +165 -0
  131. package/dist/project/merchant-guide.js +264 -0
  132. package/dist/project/mode-actions.d.ts +199 -0
  133. package/dist/project/mode-actions.js +309 -0
  134. package/dist/project/participation-radar.d.ts +18 -0
  135. package/dist/project/participation-radar.js +428 -0
  136. package/dist/project/pipeline-actions.d.ts +101 -0
  137. package/dist/project/pipeline-actions.js +109 -0
  138. package/dist/project/semantic-graph.d.ts +95 -0
  139. package/dist/project/semantic-graph.js +245 -0
  140. package/dist/project/stage-gate.js +4 -4
  141. package/dist/schema/call/allocation.d.ts +11 -11
  142. package/dist/schema/call/allocation.js +13 -3
  143. package/dist/schema/call/arbitration.d.ts +21 -21
  144. package/dist/schema/call/arbitration.js +30 -9
  145. package/dist/schema/call/base.d.ts +2 -2
  146. package/dist/schema/call/base.js +1 -1
  147. package/dist/schema/call/bridge.d.ts +127 -127
  148. package/dist/schema/call/bridge.js +12 -12
  149. package/dist/schema/call/contact.d.ts +3 -3
  150. package/dist/schema/call/contact.js +2 -2
  151. package/dist/schema/call/demand.d.ts +3 -3
  152. package/dist/schema/call/demand.js +2 -2
  153. package/dist/schema/call/guard.d.ts +11 -11
  154. package/dist/schema/call/guard.js +2 -2
  155. package/dist/schema/call/machine.d.ts +2072 -679
  156. package/dist/schema/call/machine.js +51 -5
  157. package/dist/schema/call/order.d.ts +7 -7
  158. package/dist/schema/call/order.js +3 -6
  159. package/dist/schema/call/payment.d.ts +3 -3
  160. package/dist/schema/call/permission.d.ts +3 -3
  161. package/dist/schema/call/permission.js +2 -2
  162. package/dist/schema/call/personal.d.ts +337 -3
  163. package/dist/schema/call/personal.js +10 -0
  164. package/dist/schema/call/progress.d.ts +177 -9
  165. package/dist/schema/call/progress.js +7 -3
  166. package/dist/schema/call/proof.d.ts +6 -6
  167. package/dist/schema/call/repository.d.ts +3 -3
  168. package/dist/schema/call/repository.js +2 -2
  169. package/dist/schema/call/reward.d.ts +57 -57
  170. package/dist/schema/call/reward.js +3 -3
  171. package/dist/schema/call/semantic.js +48 -2
  172. package/dist/schema/call/service.d.ts +285 -113
  173. package/dist/schema/call/service.js +92 -28
  174. package/dist/schema/call/treasury.d.ts +57 -57
  175. package/dist/schema/call/treasury.js +3 -3
  176. package/dist/schema/common/index.d.ts +2 -0
  177. package/dist/schema/common/index.js +46 -10
  178. package/dist/schema/local/index.js +5 -1
  179. package/dist/schema/messenger/index.js +4 -1
  180. package/dist/schema/operations.d.ts +1318 -317
  181. package/dist/schema/operations.js +76 -7
  182. package/dist/schema/project/index.d.ts +5662 -164
  183. package/dist/schema/project/index.js +1136 -5
  184. package/dist/schema/query/index.d.ts +580 -19
  185. package/dist/schema/query/index.js +88 -36
  186. package/dist/schema/schema-query/index.d.ts +59 -3
  187. package/dist/schema/schema-query/index.js +45 -6
  188. package/dist/schema/trust/index.d.ts +1012 -6
  189. package/dist/schema/trust/index.js +212 -11
  190. package/dist/schema/utils/node-parser.js +13 -0
  191. package/dist/schema/utils/object-type-utils.d.ts +12 -0
  192. package/dist/schema/utils/object-type-utils.js +35 -0
  193. package/dist/schema/utils/permission-machine-check.d.ts +49 -0
  194. package/dist/schema/utils/permission-machine-check.js +121 -0
  195. package/dist/schema/utils/skills-recommendation.d.ts +2 -0
  196. package/dist/schema/utils/skills-recommendation.js +77 -0
  197. package/dist/schema-query/index.d.ts +17 -1
  198. package/dist/schema-query/index.js +359 -3
  199. package/dist/schemas/account_operation.schema.json +1 -1
  200. package/dist/schemas/bridge_operation.schema.json +14 -7
  201. package/dist/schemas/guard2file.schema.json +2 -0
  202. package/dist/schemas/index.json +1 -1
  203. package/dist/schemas/machineNode2file.schema.json +2 -0
  204. package/dist/schemas/messenger_operation.schema.json +1 -1
  205. package/dist/schemas/onchain_events.output.json +1 -1
  206. package/dist/schemas/onchain_operations.output.json +2820 -0
  207. package/dist/schemas/onchain_operations.schema.json +255 -65
  208. package/dist/schemas/onchain_operations_allocation.schema.json +7 -6
  209. package/dist/schemas/onchain_operations_arbitration.schema.json +14 -10
  210. package/dist/schemas/onchain_operations_contact.schema.json +4 -3
  211. package/dist/schemas/onchain_operations_demand.schema.json +4 -3
  212. package/dist/schemas/onchain_operations_gen_passport.schema.json +4 -2
  213. package/dist/schemas/onchain_operations_gen_proof.schema.json +2 -0
  214. package/dist/schemas/onchain_operations_guard.schema.json +579 -1
  215. package/dist/schemas/onchain_operations_machine.schema.json +5 -4
  216. package/dist/schemas/onchain_operations_order.schema.json +7 -6
  217. package/dist/schemas/onchain_operations_payment.schema.json +2 -1
  218. package/dist/schemas/onchain_operations_permission.schema.json +3 -2
  219. package/dist/schemas/onchain_operations_personal.schema.json +37 -0
  220. package/dist/schemas/onchain_operations_progress.schema.json +91 -4
  221. package/dist/schemas/onchain_operations_proof.schema.json +2 -1
  222. package/dist/schemas/onchain_operations_repository.schema.json +4 -3
  223. package/dist/schemas/onchain_operations_reward.schema.json +7 -6
  224. package/dist/schemas/onchain_operations_service.schema.json +80 -19
  225. package/dist/schemas/onchain_operations_treasury.schema.json +5 -4
  226. package/dist/schemas/onchain_table_data.output.json +1 -1
  227. package/dist/schemas/onchain_table_data.schema.json +10 -9
  228. package/dist/schemas/project_operation.output.json +3318 -57
  229. package/dist/schemas/project_operation.schema.json +728 -4
  230. package/dist/schemas/query_toolkit.output.json +16 -16
  231. package/dist/schemas/query_toolkit.schema.json +40 -3
  232. package/dist/schemas/schema_query.output.json +65 -2
  233. package/dist/schemas/schema_query.schema.json +31 -5
  234. package/dist/schemas/trust_score.output.json +392 -1
  235. package/dist/schemas/trust_score.schema.json +275 -1
  236. package/dist/schemas/wowok_buildin_info.output.json +81 -8
  237. package/dist/schemas/wowok_buildin_info.schema.json +46 -2
  238. package/dist/tools/handlers/onchain.js +636 -6
  239. package/dist/tools/handlers/project.js +71 -2
  240. package/dist/tools/handlers/query.js +117 -2
  241. package/dist/tools/handlers/schema-query.js +65 -1
  242. package/dist/tools/handlers/trust.js +192 -6
  243. package/dist/tools/index.d.ts +8 -0
  244. package/dist/tools/index.js +229 -15
  245. package/dist/tools/wrap.js +194 -15
  246. package/package.json +2 -2
@@ -1,6 +1,10 @@
1
- import { readFileSync, existsSync, writeFileSync, mkdirSync } from "fs";
1
+ import { readFileSync, existsSync, writeFileSync, mkdirSync, readdirSync } from "fs";
2
2
  import { resolve, join, dirname } from "path";
3
3
  import { fileURLToPath } from "url";
4
+ import { TOOLS_REFERENCE, getToolReference, searchToolReference, getToolSequence, } from "../knowledge/tools-reference.js";
5
+ import { GUARD_DESIGN_PATTERNS, getGuardDesignPattern, GUARD_DESIGN_PATTERNS_VERSION, } from "../knowledge/guard-design-patterns.js";
6
+ import { OBJECT_REUSE_RULES, CREATE_VS_MODIFY_PATTERN, IMMUTABILITY_RULES, OPERATION_TYPE_CLASSIFICATION, OPERATION_CLASS_META, NAMING_CONVENTIONS, SAFETY_RULES_VERSION, } from "../knowledge/safety-rules.js";
7
+ import { listTemplates as listRegistryTemplates, getTemplateDetail, instantiateTemplate, getTemplateCounts, TEMPLATE_OBJECT_TYPES, } from "../knowledge/template-registry.js";
4
8
  const __filename = fileURLToPath(import.meta.url);
5
9
  const __dirname = fileURLToPath(new URL(".", import.meta.url));
6
10
  const SCHEMAS_DIR = resolve(__dirname, "../../dist/schemas");
@@ -9,6 +13,11 @@ const GUARD_TEMPLATES_PATH_DIST = resolve(__dirname, "../../dist/schemas/guard-t
9
13
  const GUARD_TEMPLATES_PATH = existsSync(GUARD_TEMPLATES_PATH_SCRIPTS)
10
14
  ? GUARD_TEMPLATES_PATH_SCRIPTS
11
15
  : GUARD_TEMPLATES_PATH_DIST;
16
+ const EXAMPLES_DIR_SCRIPTS = resolve(__dirname, "../../scripts/examples");
17
+ const EXAMPLES_DIR_DIST = resolve(__dirname, "../examples");
18
+ export const EXAMPLES_DIR = existsSync(EXAMPLES_DIR_SCRIPTS)
19
+ ? EXAMPLES_DIR_SCRIPTS
20
+ : EXAMPLES_DIR_DIST;
12
21
  const WORKSPACE_TMP_DIR = resolve(process.cwd(), ".trae", "tmp");
13
22
  export function areSchemasAvailable() {
14
23
  return existsSync(SCHEMAS_DIR) && existsSync(join(SCHEMAS_DIR, "index.json"));
@@ -96,6 +105,75 @@ export function getGuardTemplates(templateName) {
96
105
  return null;
97
106
  }
98
107
  }
108
+ export function searchExamples(query) {
109
+ if (!existsSync(EXAMPLES_DIR)) {
110
+ return [];
111
+ }
112
+ let files;
113
+ try {
114
+ files = readdirSync(EXAMPLES_DIR);
115
+ }
116
+ catch {
117
+ return [];
118
+ }
119
+ const lowerQuery = query.toLowerCase().trim();
120
+ if (!lowerQuery) {
121
+ return [];
122
+ }
123
+ const results = [];
124
+ for (const file of files) {
125
+ if (!file.endsWith(".json"))
126
+ continue;
127
+ const filePath = join(EXAMPLES_DIR, file);
128
+ try {
129
+ const content = readFileSync(filePath, "utf-8");
130
+ const example = JSON.parse(content);
131
+ const title = String(example.title ?? "");
132
+ const description = String(example.description ?? "");
133
+ const tags = Array.isArray(example.tags) ? example.tags.map((t) => String(t)) : [];
134
+ const operationType = String(example.operation_type ?? "");
135
+ const industry = String(example.industry ?? "");
136
+ const matchedFields = [];
137
+ if (title.toLowerCase().includes(lowerQuery)) {
138
+ matchedFields.push("title");
139
+ }
140
+ if (description.toLowerCase().includes(lowerQuery)) {
141
+ matchedFields.push("description");
142
+ }
143
+ if (tags.some((t) => t.toLowerCase() === lowerQuery)) {
144
+ matchedFields.push("tags");
145
+ }
146
+ if (operationType && operationType.toLowerCase() === lowerQuery) {
147
+ matchedFields.push("operation_type");
148
+ }
149
+ if (industry && industry.toLowerCase() === lowerQuery) {
150
+ matchedFields.push("industry");
151
+ }
152
+ if (matchedFields.length > 0) {
153
+ results.push({
154
+ file,
155
+ title,
156
+ description,
157
+ tags,
158
+ industry,
159
+ operation_type: operationType,
160
+ verified: example.verified === true,
161
+ score: matchedFields.length,
162
+ matched_fields: matchedFields,
163
+ });
164
+ }
165
+ }
166
+ catch {
167
+ continue;
168
+ }
169
+ }
170
+ results.sort((a, b) => {
171
+ if (b.score !== a.score)
172
+ return b.score - a.score;
173
+ return a.file.localeCompare(b.file);
174
+ });
175
+ return results;
176
+ }
99
177
  export function getSchemaField(name, fieldPath) {
100
178
  const schema = getSchema(name);
101
179
  if (!schema)
@@ -228,7 +306,7 @@ function writeResponseToFile(data, preferredPath) {
228
306
  }
229
307
  }
230
308
  export function processSchemaQuery(request) {
231
- const { action, name, query, field_path, template, output_file } = request;
309
+ const { action, name, query, field_path, template, output_file, object_type, params } = request;
232
310
  if (action === "get_guard_templates") {
233
311
  const templates = getGuardTemplates(template);
234
312
  if (!templates) {
@@ -267,6 +345,284 @@ export function processSchemaQuery(request) {
267
345
  : `Retrieved ${Array.isArray(templates.templates) ? templates.templates.length : 0} Guard templates`,
268
346
  };
269
347
  }
348
+ if (action === "get_templates") {
349
+ if (!template) {
350
+ const metas = listRegistryTemplates(object_type);
351
+ const counts = getTemplateCounts();
352
+ const data = {
353
+ total: metas.length,
354
+ filter: object_type ?? null,
355
+ counts_by_object_type: counts,
356
+ templates: metas,
357
+ };
358
+ if (output_file) {
359
+ const filePath = writeResponseToFile(data, output_file);
360
+ if (filePath) {
361
+ return {
362
+ success: true,
363
+ action,
364
+ data: null,
365
+ message: `${metas.length} templates written to file: ${filePath}`,
366
+ output_file_path: filePath,
367
+ suggestions: [`Use Read tool to open ${filePath}`],
368
+ };
369
+ }
370
+ }
371
+ return {
372
+ success: true,
373
+ action,
374
+ data,
375
+ message: `${metas.length} template(s)${object_type ? ` for object_type='${object_type}'` : ""} ` +
376
+ `(total registry: ${Object.values(counts).reduce((a, b) => a + b, 0)} across ${TEMPLATE_OBJECT_TYPES.length} object types). ` +
377
+ `Provide 'template' (id) for full detail; add 'params' (JSON string) to instantiate.`,
378
+ };
379
+ }
380
+ if (!params) {
381
+ const detail = getTemplateDetail(template);
382
+ if (!detail) {
383
+ return {
384
+ success: false,
385
+ action,
386
+ data: null,
387
+ message: `Template '${template}' not found in the unified registry.`,
388
+ suggestions: [
389
+ "Omit 'template' to list all template metadata (id + object_type + parameters).",
390
+ `Filter by object_type: ${TEMPLATE_OBJECT_TYPES.join(", ")}`,
391
+ ],
392
+ };
393
+ }
394
+ if (output_file) {
395
+ const filePath = writeResponseToFile(detail, output_file);
396
+ if (filePath) {
397
+ return {
398
+ success: true,
399
+ action,
400
+ data: null,
401
+ message: `Template '${template}' detail written to file: ${filePath}`,
402
+ output_file_path: filePath,
403
+ suggestions: [`Use Read tool to open ${filePath}`],
404
+ };
405
+ }
406
+ }
407
+ return {
408
+ success: true,
409
+ action,
410
+ data: detail,
411
+ message: `Template '${template}' (${detail.object_type}, ${detail.instantiable ? "instantiable" : "guidance-only"}). ` +
412
+ `To instantiate, call again with 'params' = JSON object of the declared parameters.`,
413
+ };
414
+ }
415
+ let parsedParams;
416
+ try {
417
+ const parsed = JSON.parse(params);
418
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
419
+ return {
420
+ success: false,
421
+ action,
422
+ data: null,
423
+ message: `'params' must be a JSON object (e.g. '{"key":"value"}'), got ${Array.isArray(parsed) ? "array" : typeof parsed}.`,
424
+ };
425
+ }
426
+ parsedParams = parsed;
427
+ }
428
+ catch (e) {
429
+ return {
430
+ success: false,
431
+ action,
432
+ data: null,
433
+ message: `Failed to parse 'params' as JSON: ${e instanceof Error ? e.message : String(e)}`,
434
+ suggestions: ["Example: params='{\"whitelist\":[\"0xabc...\"]}'"],
435
+ };
436
+ }
437
+ const result = instantiateTemplate(template, parsedParams);
438
+ if (!result.ok) {
439
+ return {
440
+ success: false,
441
+ action,
442
+ data: result.guidance !== undefined ? { guidance: result.guidance } : null,
443
+ message: `Instantiation failed for '${template}': ${result.error}`,
444
+ suggestions: result.missing_params
445
+ ? [`Missing required params: ${result.missing_params.join(", ")}`, "Call with 'template' only (no 'params') to see full parameter declarations."]
446
+ : ["Call with 'template' only (no 'params') to see full parameter declarations."],
447
+ };
448
+ }
449
+ const data = {
450
+ object_type: result.object_type,
451
+ template_id: result.template_id,
452
+ body: result.body,
453
+ ...(result.notes ? { notes: result.notes } : {}),
454
+ };
455
+ if (output_file) {
456
+ const filePath = writeResponseToFile(data, output_file);
457
+ if (filePath) {
458
+ return {
459
+ success: true,
460
+ action,
461
+ data: null,
462
+ message: `Instantiated template '${template}' written to file: ${filePath}`,
463
+ output_file_path: filePath,
464
+ suggestions: [`Use Read tool to open ${filePath}`],
465
+ };
466
+ }
467
+ }
468
+ return {
469
+ success: true,
470
+ action,
471
+ data,
472
+ message: `Instantiated '${template}' (${result.object_type}). ` +
473
+ `Review the body against the onchain_operations schema before submitting.`,
474
+ };
475
+ }
476
+ if (action === "search_examples") {
477
+ if (!query) {
478
+ return {
479
+ success: false,
480
+ action,
481
+ data: null,
482
+ message: "Search query is required for 'search_examples' action",
483
+ suggestions: [
484
+ "Provide a 'query' string (e.g. 'rental', 'guard', 'service', 'machine')",
485
+ "Searchable fields: title, description, tags, operation_type, industry",
486
+ ],
487
+ };
488
+ }
489
+ const results = searchExamples(query);
490
+ return {
491
+ success: true,
492
+ action,
493
+ data: results,
494
+ message: `Found ${results.length} example(s) matching '${query}'`,
495
+ suggestions: results.length === 0
496
+ ? [
497
+ "Try broader terms like 'service', 'machine', 'guard', 'permission'",
498
+ "Try an industry name: 'rental', 'retail', 'general'",
499
+ "Use 'get' action with a schema name to see the full JSON Schema",
500
+ ]
501
+ : undefined,
502
+ };
503
+ }
504
+ if (action === "get_tool_reference") {
505
+ if (name) {
506
+ const entry = getToolReference(name);
507
+ if (!entry) {
508
+ return {
509
+ success: false,
510
+ action,
511
+ data: null,
512
+ message: `Tool '${name}' not found in the tool reference.`,
513
+ suggestions: [
514
+ "Omit 'name' to list all tools.",
515
+ `Available tools: ${TOOLS_REFERENCE.map((t) => t.name).join(", ")}`,
516
+ ],
517
+ };
518
+ }
519
+ const sequence = getToolSequence(name);
520
+ return {
521
+ success: true,
522
+ action,
523
+ data: { tool: entry, call_sequence: sequence ?? null },
524
+ message: `Retrieved tool reference: ${name}`,
525
+ };
526
+ }
527
+ if (query) {
528
+ const matches = searchToolReference(query);
529
+ return {
530
+ success: true,
531
+ action,
532
+ data: { tools: matches, count: matches.length },
533
+ message: `Found ${matches.length} tool(s) matching '${query}'`,
534
+ suggestions: matches.length === 0
535
+ ? ["Try a broader keyword (e.g. 'onchain', 'guard', 'schema'), or omit 'query' to list all tools."]
536
+ : undefined,
537
+ };
538
+ }
539
+ const catalog = TOOLS_REFERENCE.map((t) => ({
540
+ name: t.name,
541
+ summary: t.summary,
542
+ actions: t.actions ?? [],
543
+ notes: t.notes ?? [],
544
+ }));
545
+ return {
546
+ success: true,
547
+ action,
548
+ data: { tools: catalog, count: catalog.length },
549
+ message: `Retrieved reference for ${catalog.length} MCP tools. Pass name='<tool>' for full detail (params, prerequisites, follow-ups).`,
550
+ };
551
+ }
552
+ if (action === "get_guard_design_patterns") {
553
+ if (name) {
554
+ const pattern = getGuardDesignPattern(name);
555
+ if (!pattern) {
556
+ return {
557
+ success: false,
558
+ action,
559
+ data: null,
560
+ message: `Guard design pattern '${name}' not found.`,
561
+ suggestions: [
562
+ "Omit 'name' to list the full catalog.",
563
+ `Available pattern ids: ${GUARD_DESIGN_PATTERNS.map((p) => p.id).join(", ")}`,
564
+ ],
565
+ };
566
+ }
567
+ return {
568
+ success: true,
569
+ action,
570
+ data: { pattern },
571
+ message: `Retrieved Guard design pattern: ${name}`,
572
+ };
573
+ }
574
+ if (query) {
575
+ const byHost = GUARD_DESIGN_PATTERNS.filter((p) => p.host === query);
576
+ const matches = byHost.length > 0
577
+ ? byHost
578
+ : GUARD_DESIGN_PATTERNS.filter((p) => p.business_requirement.toLowerCase().includes(query.toLowerCase()) ||
579
+ p.logic_summary.toLowerCase().includes(query.toLowerCase()));
580
+ return {
581
+ success: true,
582
+ action,
583
+ data: { patterns: matches, count: matches.length, filtered_by: byHost.length > 0 ? "host" : "keyword" },
584
+ message: `Found ${matches.length} Guard design pattern(s) matching '${query}'`,
585
+ suggestions: matches.length === 0
586
+ ? ["Filter by host: service_buy_guard, service_allocator_guard, machine_forward, progress_submission, reward_claim, repository_write, arbitration_usage, arbitration_voting, gen_passport"]
587
+ : undefined,
588
+ };
589
+ }
590
+ const catalog = GUARD_DESIGN_PATTERNS.map((p) => ({
591
+ id: p.id,
592
+ business_requirement: p.business_requirement,
593
+ host: p.host,
594
+ data_source: p.data_source,
595
+ verifier_level: p.verifier_level,
596
+ logic_summary: p.logic_summary,
597
+ key_queries: p.key_queries,
598
+ notes: p.notes ?? [],
599
+ }));
600
+ return {
601
+ success: true,
602
+ action,
603
+ data: { patterns: catalog, count: catalog.length, version: GUARD_DESIGN_PATTERNS_VERSION },
604
+ message: `Retrieved ${catalog.length} Guard design patterns. Pass name='<pattern_id>' for full detail (witness types, mitigated risks, industries).`,
605
+ };
606
+ }
607
+ if (action === "get_safety_rules") {
608
+ return {
609
+ success: true,
610
+ action,
611
+ data: {
612
+ version: SAFETY_RULES_VERSION,
613
+ object_reuse_rules: OBJECT_REUSE_RULES,
614
+ create_vs_modify_pattern: CREATE_VS_MODIFY_PATTERN,
615
+ immutability_rules: IMMUTABILITY_RULES,
616
+ operation_type_classification: OPERATION_TYPE_CLASSIFICATION,
617
+ operation_class_meta: OPERATION_CLASS_META,
618
+ naming_conventions: NAMING_CONVENTIONS,
619
+ },
620
+ message: "Retrieved safety rule tables (reuse / immutability / operation classification / naming). " +
621
+ "Key points: prefer REUSING existing objects (string reference = reuse, object shape = create); " +
622
+ "Machine publish locks nodes/pairs/forwards, Service publish locks machine/order_allocators/arbitrations (sales stays mutable); " +
623
+ "Guard is CREATE-only immutable; on-chain writes require explicit user confirmation.",
624
+ };
625
+ }
270
626
  if (!areSchemasAvailable()) {
271
627
  return {
272
628
  success: false,
@@ -448,7 +804,7 @@ export function processSchemaQuery(request) {
448
804
  action,
449
805
  data: null,
450
806
  message: `Unknown action: ${action}`,
451
- suggestions: ["Use 'list', 'get', 'get_field', 'get_output', 'search', 'list_operations', or 'get_guard_templates'"],
807
+ suggestions: ["Use 'list', 'get', 'get_field', 'get_output', 'search', 'list_operations', 'get_guard_templates', or 'search_examples'"],
452
808
  };
453
809
  }
454
810
  }
@@ -236,7 +236,7 @@
236
236
  }
237
237
  },
238
238
  "additionalProperties": false,
239
- "description": "Account operations. Parameters MUST be wrapped in the operation type property (e.g. {transfer: {...}}, NOT {amount: ...}). Unwrapped parameters are rejected."
239
+ "description": "Account operations (mutations only: gen/faucet/suspend/resume/rename/swap_name/transfer/get/signData/messenger). Parameters MUST be wrapped in the operation type property (e.g. {transfer: {...}}, NOT {amount: ...}). Unwrapped parameters are rejected. TO LIST ALL ACCOUNTS: use the query_toolkit tool with query_type='account_list' (returns name, address, suspended status, messenger status for all local accounts). This separation follows CQRS: account_operation = mutations, query_toolkit = queries. Common workflow after MCP restart: (1) query_toolkit query_type='account_list' to see all accounts, (2) account_operation with the appropriate mutation."
240
240
  }
241
241
  }
242
242
  }
@@ -108,6 +108,7 @@
108
108
  },
109
109
  "schema_strict_mode": {
110
110
  "type": "boolean",
111
+ "default": false,
111
112
  "description": "When true, schema incompatibility returns an error instead of a warning. Default: false (warn mode)."
112
113
  },
113
114
  "dry_run": {
@@ -289,7 +290,7 @@
289
290
  "mainnet"
290
291
  ],
291
292
  "default": "mainnet",
292
- "description": "Target chain (defaults to Ethereum mainnet)"
293
+ "description": "Target chain (defaults to Ethereum mainnet when omitted — EvmChainSchema carries .default(\"mainnet\"))"
293
294
  }
294
295
  },
295
296
  "required": [
@@ -319,6 +320,7 @@
319
320
  "properties": {
320
321
  "network": {
321
322
  "$ref": "#/definitions/bridge_operation/anyOf/4/properties/data/properties/network",
323
+ "default": "mainnet",
322
324
  "description": "Specific chain; if omitted, queries all supported chains"
323
325
  },
324
326
  "tokens": {
@@ -364,7 +366,7 @@
364
366
  "type": "object",
365
367
  "properties": {
366
368
  "network": {
367
- "$ref": "#/definitions/bridge_operation/anyOf/4/properties/data/properties/network",
369
+ "$ref": "#/definitions/bridge_operation/anyOf/5/properties/data/properties/network",
368
370
  "description": "Specific chain; if omitted, returns token lists for all supported chains"
369
371
  }
370
372
  },
@@ -485,7 +487,8 @@
485
487
  },
486
488
  "network": {
487
489
  "$ref": "#/definitions/bridge_operation/anyOf/4/properties/data/properties/network",
488
- "description": "Target chain (defaults to Ethereum mainnet)"
490
+ "default": "mainnet",
491
+ "description": "Target chain (defaults to Ethereum mainnet when omitted — EvmChainSchema carries .default(\"mainnet\"))"
489
492
  }
490
493
  },
491
494
  "required": [
@@ -504,7 +507,8 @@
504
507
  },
505
508
  "network": {
506
509
  "$ref": "#/definitions/bridge_operation/anyOf/4/properties/data/properties/network",
507
- "description": "Target chain (defaults to Ethereum mainnet)"
510
+ "default": "mainnet",
511
+ "description": "Target chain (defaults to Ethereum mainnet when omitted — EvmChainSchema carries .default(\"mainnet\"))"
508
512
  },
509
513
  "rpcUrls": {
510
514
  "type": "array",
@@ -533,7 +537,8 @@
533
537
  },
534
538
  "network": {
535
539
  "$ref": "#/definitions/bridge_operation/anyOf/4/properties/data/properties/network",
536
- "description": "Target chain (defaults to Ethereum mainnet)"
540
+ "default": "mainnet",
541
+ "description": "Target chain (defaults to Ethereum mainnet when omitted — EvmChainSchema carries .default(\"mainnet\"))"
537
542
  },
538
543
  "rpcUrls": {
539
544
  "type": "array",
@@ -562,7 +567,8 @@
562
567
  },
563
568
  "network": {
564
569
  "$ref": "#/definitions/bridge_operation/anyOf/4/properties/data/properties/network",
565
- "description": "Target chain (defaults to Ethereum mainnet)"
570
+ "default": "mainnet",
571
+ "description": "Target chain (defaults to Ethereum mainnet when omitted — EvmChainSchema carries .default(\"mainnet\"))"
566
572
  },
567
573
  "rpcUrls": {
568
574
  "type": "array",
@@ -591,7 +597,8 @@
591
597
  },
592
598
  "network": {
593
599
  "$ref": "#/definitions/bridge_operation/anyOf/4/properties/data/properties/network",
594
- "description": "Target chain (defaults to Ethereum mainnet)"
600
+ "default": "mainnet",
601
+ "description": "Target chain (defaults to Ethereum mainnet when omitted — EvmChainSchema carries .default(\"mainnet\"))"
595
602
  },
596
603
  "rpcUrls": {
597
604
  "type": "array",
@@ -22,6 +22,7 @@
22
22
  "json",
23
23
  "markdown"
24
24
  ],
25
+ "default": "json",
25
26
  "description": "Output format: 'json' (default) or 'markdown'"
26
27
  },
27
28
  "env": {
@@ -77,6 +78,7 @@
77
78
  },
78
79
  "schema_strict_mode": {
79
80
  "type": "boolean",
81
+ "default": false,
80
82
  "description": "When true, schema incompatibility returns an error instead of a warning. Default: false (warn mode)."
81
83
  },
82
84
  "dry_run": {
@@ -2,7 +2,7 @@
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "title": "WoWok MCP Schema Index",
4
4
  "description": "Index of all available JSON schemas for WoWok MCP tools",
5
- "generatedAt": "2026-07-26T22:55:28.022Z",
5
+ "generatedAt": "2026-08-01T01:54:35.836Z",
6
6
  "tools": [
7
7
  {
8
8
  "name": "onchain_operations",
@@ -22,6 +22,7 @@
22
22
  "json",
23
23
  "markdown"
24
24
  ],
25
+ "default": "json",
25
26
  "description": "Output format: 'json' (default) or 'markdown'"
26
27
  },
27
28
  "env": {
@@ -77,6 +78,7 @@
77
78
  },
78
79
  "schema_strict_mode": {
79
80
  "type": "boolean",
81
+ "default": false,
80
82
  "description": "When true, schema incompatibility returns an error instead of a warning. Default: false (warn mode)."
81
83
  },
82
84
  "dry_run": {
@@ -1423,7 +1423,7 @@
1423
1423
  "additionalProperties": false
1424
1424
  }
1425
1425
  ],
1426
- "description": "Messenger operation input schema"
1426
+ "description": "Messenger operation input schema. PREREQUISITE: an account must ENABLE messenger before sending/receiving. There is NO 'enable' operation in this tool — enable via account_operation {messenger: {enabled: true, name_or_account: '<account>'}}, or implicitly via send_message/send_file with options.enable_messenger: true. Use proof_message to anchor a message's WTS proof on-chain (creates a Proof object consumable by Guards via proof.signer/proof.time queries)."
1427
1427
  }
1428
1428
  }
1429
1429
  }
@@ -219,7 +219,7 @@
219
219
  "number",
220
220
  "string"
221
221
  ],
222
- "description": "A coin/balance amount in the smallest on-chain unit (u64). Accepts a JS number OR a numeric string. PRECISION RULE: for values exceeding 2^53 (e.g. token amounts with 18 decimals), ALWAYS pass a numeric STRING (e.g. \"1000000000000000000\") to preserve precision — JS numbers lose precision above 2^53. UNIT: this is the smallest unit, NOT the display unit. For SUI: 1 SUI = 10^9 MIST, so 10 SUI = 10000000000. For custom tokens: use the token's native smallest unit (decimals from coin metadata). Examples: 10000000000 (10 SUI), \"1000000000000000000\" (1 token with 18 decimals), 500 (500 units of a token with 0 decimals). Used for: Service.sale.price, Service.compensation_fund_add balance, Treasury.deposit, Arbitration.fee, Reward.amount, stock quantities."
222
+ "description": "A coin/balance amount. Accepts three formats: (1) DISPLAY FORMAT with token symbol: \"2.5WOW\", \"10USDC\", \"0.05SUI\" — auto-converted to smallest units via the Fund Processing Layer (token precision resolved from official registry → cache → on-chain). The symbol MUST match the token's type_parameter. (2) SMALLEST UNIT (numeric string): \"10000000000\" — used as-is, no conversion. (3) SMALLEST UNIT (number): 10000000000 — used as-is (loses precision above 2^53). PRECISION RULE: for values exceeding 2^53, ALWAYS use format (1) or (2) — JS numbers lose precision. Default token: WOW (9 decimals, 1 WOW = 10^9 MIST). For custom tokens: use display format with the token's symbol, or pass smallest units directly. MONEY CONFIRMATION: all monetary fields trigger user confirmation via the Fund Processing Layer. If multiple tokens share a symbol (ambiguity), specify the full type string in type_parameter. Examples: \"2.5WOW\" (display → 2500000000), 10000000000 (number, smallest unit), \"50000000000\" (string, smallest unit). Used for: Service.sale.price, Service.compensation_fund_add balance, Treasury.deposit, Arbitration.fee, Reward.amount, stock quantities."
223
223
  }
224
224
  },
225
225
  "required": [