@wowok/agent-mcp 2.3.6 → 2.3.8
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.
- package/dist/index.d.ts +1 -15838
- package/dist/index.js +40 -394
- package/dist/schema/call/bridge-handler.d.ts +5 -0
- package/dist/schema/call/bridge-handler.js +234 -0
- package/dist/schema/call/bridge.d.ts +2212 -0
- package/dist/schema/call/bridge.js +408 -0
- package/dist/schema/call/handler.js +29 -15
- package/dist/schema/call/index.d.ts +1 -0
- package/dist/schema/call/index.js +1 -0
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/index.js +1 -0
- package/dist/schema/messenger/index.d.ts +74 -74
- package/dist/schema/operations.d.ts +24302 -0
- package/dist/schema/operations.js +393 -0
- package/dist/schema-query/index.d.ts +3 -1
- package/dist/schema-query/index.js +63 -3
- package/dist/schemas/account_operation.output.json +1395 -0
- package/dist/schemas/bridge_operation.output.json +64 -0
- package/dist/schemas/bridge_operation.schema.json +547 -0
- package/dist/schemas/guard2file.output.json +84 -0
- package/dist/schemas/index.json +33 -14
- package/dist/schemas/local_info_operation.output.json +70 -0
- package/dist/schemas/local_mark_operation.output.json +114 -0
- package/dist/schemas/machineNode2file.output.json +89 -0
- package/dist/schemas/messenger_operation.output.json +1068 -0
- package/dist/schemas/onchain_events.output.json +513 -0
- package/dist/schemas/onchain_operations.output.json +1764 -0
- package/dist/schemas/onchain_operations.schema.json +8324 -49
- package/dist/schemas/onchain_table_data.output.json +1938 -0
- package/dist/schemas/onchain_table_data.schema.json +483 -22
- package/dist/schemas/query_toolkit.output.json +18 -0
- package/dist/schemas/query_toolkit.schema.json +454 -19
- package/dist/schemas/schema_query.output.json +42 -0
- package/dist/schemas/schema_query.schema.json +1 -0
- package/dist/schemas/wip_file.output.json +116 -0
- package/dist/schemas/wip_file.schema.json +163 -15
- package/dist/schemas/wowok_buildin_info.output.json +577 -0
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -5,7 +5,8 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
5
5
|
import { readFileSync } from "fs";
|
|
6
6
|
import { resolve } from "path";
|
|
7
7
|
const packageJson = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf-8"));
|
|
8
|
-
import {
|
|
8
|
+
import { MachineNode2File_InputSchema, MachineNode2File_OutputWrappedSchema, Guard2File_InputSchema, Guard2File_OutputWrappedSchema, strictParse, CallOutputSchema, handleCallResult, createServerConfig, createCapabilitiesConfig, createToolMeta, transformSubmission, getEnvConfig, OnchainEventsInputSchema, OnchainEventsResultSchema, ProtocolInfoQuerySchema, ProtocolInfoResultSchema, AccountOperationOutputWrappedSchema, LocalMarkOperationOutputWrappedSchema, LocalInfoOperationOutputWrappedSchema, WipOperationOutputSchema, MessengerOperationOutputSchema, AccountOperationSchema, LocalMarkOperationSchema, LocalInfoOperationSchema, parseMachineNodesFromText, formatNodeErrors as formatMachineNodeErrors, MessengerOperationInputSchema, BridgeOperationsSchema, BridgeCallOutputSchema, OnchainOperationsSchema, WipOperationsSchema, OnchainTableDataSchema, OnchainTableDataResultSchema, WatchQueryOperationsSchema, } from "./schema/index.js";
|
|
9
|
+
import { handleBridgeOperations } from "./schema/call/bridge-handler.js";
|
|
9
10
|
import { CallService, CallMachine, CallProgress, CallPermission, CallGuard, CallArbitration, CallRepository, CallContact, CallTreasury, CallReward, CallAllocation, CallPersonal, CallPayment, CallDemand, CallOrder, gen_passport, guard2file, parseGuardFile, formatGuardParseErrors, machineNode2file, generateNodeComments, generate_wip, verify_wip, sign_wip, wip2html, account_operation, local_mark_operation, local_info_operation, watch_conversations, send_message, send_file, watch_messages, extract_zip_messages, generate_wts, verify_wts, sign_wts, wts2html, proof_message, mark_messages_as_viewed, mark_conversation_as_viewed, query_local_mark_list, query_account_list, query_local_info_list, query_local_token_list, query_account, GetLocalNamesByAddresses, query_personal, query_objects, query_table, query_tableItem, queryProtocolInfo, query_received, queryTableItem_RepositoryData, queryTableItem_PermissionPerm, queryTableItem_RewardRecord, queryTableItem_DemandPresenter, queryTableItem_TreasuryHistory, queryTableItem_MachineNode, queryTableItem_ProgressHistory, queryTableItem_AddressMark, queryTableItem_EntityRegistrar, queryTableItem_EntityLinker, query_events, blacklist, friendslist, guardlist, settings, AmountType, } from "@wowok/wowok";
|
|
10
11
|
import { areSchemasAvailable, getSchemaIndex, processSchemaQuery, } from "./schema-query/index.js";
|
|
11
12
|
const SERVER_DESCRIPTION = `WoWok MCP Server - Making It Easy for AI Agents to Communicate, Collaborate, Trade, and Trust.
|
|
@@ -148,310 +149,6 @@ function transformRewardData(data) {
|
|
|
148
149
|
}
|
|
149
150
|
return transformed;
|
|
150
151
|
}
|
|
151
|
-
const OnchainOperationsSchema = z.preprocess((input) => {
|
|
152
|
-
if (typeof input === 'object' && input !== null) {
|
|
153
|
-
const obj = { ...input };
|
|
154
|
-
if (typeof obj.description === 'string' && !obj.operation_type) {
|
|
155
|
-
try {
|
|
156
|
-
const parsed = JSON.parse(obj.description);
|
|
157
|
-
if (parsed && typeof parsed === 'object' && parsed.operation_type) {
|
|
158
|
-
return parsed;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
catch { }
|
|
162
|
-
}
|
|
163
|
-
if (typeof obj.data === 'string') {
|
|
164
|
-
try {
|
|
165
|
-
obj.data = JSON.parse(obj.data);
|
|
166
|
-
}
|
|
167
|
-
catch { }
|
|
168
|
-
}
|
|
169
|
-
if (typeof obj.env === 'string') {
|
|
170
|
-
try {
|
|
171
|
-
obj.env = JSON.parse(obj.env);
|
|
172
|
-
}
|
|
173
|
-
catch { }
|
|
174
|
-
}
|
|
175
|
-
if (typeof obj.submission === 'string') {
|
|
176
|
-
try {
|
|
177
|
-
obj.submission = JSON.parse(obj.submission);
|
|
178
|
-
}
|
|
179
|
-
catch { }
|
|
180
|
-
}
|
|
181
|
-
if (typeof obj.info === 'string') {
|
|
182
|
-
try {
|
|
183
|
-
obj.info = JSON.parse(obj.info);
|
|
184
|
-
}
|
|
185
|
-
catch { }
|
|
186
|
-
}
|
|
187
|
-
return obj;
|
|
188
|
-
}
|
|
189
|
-
return input;
|
|
190
|
-
}, z.discriminatedUnion("operation_type", [
|
|
191
|
-
z.object({
|
|
192
|
-
operation_type: z.literal("service"),
|
|
193
|
-
data: CallService_DataSchema,
|
|
194
|
-
env: CallEnvSchema.optional(),
|
|
195
|
-
submission: SubmissionCallSchema.optional(),
|
|
196
|
-
}).describe("🏪 Service Object: Create and manage product/service listings with transparent promises, bind workflow templates to order processing, set pricing, issue discount coupons to customers, and establish quality standards, etc.."),
|
|
197
|
-
z.object({
|
|
198
|
-
operation_type: z.literal("machine"),
|
|
199
|
-
data: CallMachine_DataSchema,
|
|
200
|
-
env: CallEnvSchema.optional(),
|
|
201
|
-
submission: SubmissionCallSchema.optional(),
|
|
202
|
-
}).describe("⚙️ Machine Object: Design and deploy automated workflow templates (Machines) that define how services are delivered, etc.."),
|
|
203
|
-
z.object({
|
|
204
|
-
operation_type: z.literal("progress"),
|
|
205
|
-
data: CallProgress_DataSchema,
|
|
206
|
-
env: CallEnvSchema.optional(),
|
|
207
|
-
submission: SubmissionCallSchema.optional(),
|
|
208
|
-
}).describe("📊 Progress Object: Track and manage active workflows in real-time."),
|
|
209
|
-
z.object({
|
|
210
|
-
operation_type: z.literal("repository"),
|
|
211
|
-
data: CallRepository_DataSchema,
|
|
212
|
-
env: CallEnvSchema.optional(),
|
|
213
|
-
submission: SubmissionCallSchema.optional(),
|
|
214
|
-
}).describe("📦 Repository Object: Read/write database with consensus field + address as key, strongly-typed data as value."),
|
|
215
|
-
z.object({
|
|
216
|
-
operation_type: z.literal("arbitration"),
|
|
217
|
-
data: CallArbitration_DataSchema,
|
|
218
|
-
env: CallEnvSchema.optional(),
|
|
219
|
-
submission: SubmissionCallSchema.optional(),
|
|
220
|
-
}).describe("⚖️ Arbitration Object: Access a transparent on-chain arbitration system for resolving order conflicts."),
|
|
221
|
-
z.object({
|
|
222
|
-
operation_type: z.literal("contact"),
|
|
223
|
-
data: CallContact_DataSchema,
|
|
224
|
-
env: CallEnvSchema.optional(),
|
|
225
|
-
submission: SubmissionCallSchema.optional(),
|
|
226
|
-
}).describe("💬 Contact Object: Manage on-chain instant messaging contact profiles."),
|
|
227
|
-
z.object({
|
|
228
|
-
operation_type: z.literal("treasury"),
|
|
229
|
-
data: CallTreasury_DataSchema,
|
|
230
|
-
env: CallEnvSchema.optional(),
|
|
231
|
-
submission: SubmissionCallSchema.optional(),
|
|
232
|
-
}).describe("💰 Treasury Object: Create and manage treasury for team funds with deposit/withdrawal rules, etc.."),
|
|
233
|
-
z.object({
|
|
234
|
-
operation_type: z.literal("reward"),
|
|
235
|
-
data: CallReward_DataSchema,
|
|
236
|
-
env: CallEnvSchema.optional(),
|
|
237
|
-
submission: SubmissionCallSchema.optional(),
|
|
238
|
-
}).describe("🎁 Reward Object: Create reward pools and set claim conditions by Guard verification."),
|
|
239
|
-
z.object({
|
|
240
|
-
operation_type: z.literal("allocation"),
|
|
241
|
-
data: CallAllocation_DataSchema,
|
|
242
|
-
env: CallEnvSchema.optional(),
|
|
243
|
-
submission: SubmissionCallSchema.optional(),
|
|
244
|
-
}).describe("📤 Allocation Object: Create distribution plans to auto-distribute funds to multiple recipients."),
|
|
245
|
-
z.object({
|
|
246
|
-
operation_type: z.literal("permission"),
|
|
247
|
-
data: CallPermission_DataSchema,
|
|
248
|
-
env: CallEnvSchema.optional(),
|
|
249
|
-
}).describe("🔐 Permission Object: Define who can perform which operations on WoWok objects. Important Note: If needed, you should first query 'guard instructions' through the 'wowok_buildin_info' tool."),
|
|
250
|
-
z.object({
|
|
251
|
-
operation_type: z.literal("guard"),
|
|
252
|
-
data: CallGuard_DataSchema,
|
|
253
|
-
env: CallEnvSchema.optional(),
|
|
254
|
-
}).describe("🛡️ Guard Object: Create immutable programmable validation rules that return boolean results. Set 'namedNew' to name the new Guard. Use root.type='node' for direct node tree or root.type='file' to load from file. Use 'wowok_buildin_info' tool with query='guard instructions' for all available operations. NOTE for EntityLinker/EntityRegistrar queries: Add system addresses to the Guard table - ENTITY_LINKER_ADDRESS (0xaaa) for EntityLinker, ENTITY_REGISTRAR_ADDRESS (0xaab) for EntityRegistrar."),
|
|
255
|
-
z.object({
|
|
256
|
-
operation_type: z.literal("personal"),
|
|
257
|
-
data: CallPersonal_DataSchema,
|
|
258
|
-
env: CallEnvSchema.optional(),
|
|
259
|
-
}).describe("🆔 Public Identity Profile: Establish and manage your on-chain public identity. ⚠️ CRITICAL: Everything here is PERMANENTLY PUBLIC on the blockchain!"),
|
|
260
|
-
z.object({
|
|
261
|
-
operation_type: z.literal("payment"),
|
|
262
|
-
data: CallPayment_DataSchema,
|
|
263
|
-
env: CallEnvSchema.optional(),
|
|
264
|
-
}).describe("💰 Payment Object: Send instant, irreversible coin transfers to any wallet address."),
|
|
265
|
-
z.object({
|
|
266
|
-
operation_type: z.literal("demand"),
|
|
267
|
-
data: CallDemand_DataSchema,
|
|
268
|
-
env: CallEnvSchema.optional(),
|
|
269
|
-
submission: SubmissionCallSchema.optional(),
|
|
270
|
-
}).describe("🎯 Demand Object: Post service requests with reward pools on-chain."),
|
|
271
|
-
z.object({
|
|
272
|
-
operation_type: z.literal("order"),
|
|
273
|
-
data: CallOrder_DataSchema,
|
|
274
|
-
env: CallEnvSchema.optional(),
|
|
275
|
-
submission: SubmissionCallSchema.optional(),
|
|
276
|
-
}).describe("📦 Order Object: Manage the order lifecycle, Including operating order arbitration (Arb Object associated with the order), advancing progress (Progress Object associated with the order), extracting order refunds/payments, setting agents, etc."),
|
|
277
|
-
z.object({
|
|
278
|
-
operation_type: z.literal("gen_passport"),
|
|
279
|
-
guard: z.union([z.string(), z.array(z.string())]).describe("Guard object ID(s) to verify and generate passport from. Can be a single guard (string) or multiple guards (array of strings). Supports guard names or addresses."),
|
|
280
|
-
info: SubmissionCallSchema.optional().describe("Optional submission data. If not provided, will attempt to get existing submissions from the guard."),
|
|
281
|
-
env: CallEnvSchema.optional(),
|
|
282
|
-
}).describe("🛂 Generate Verified Passport Object: Create immutable verified credentials after Guard validation passes. Supports verifying multiple guards at once."),
|
|
283
|
-
]));
|
|
284
|
-
const WipOperationsSchema = z.preprocess((input) => {
|
|
285
|
-
if (typeof input === 'object' && input !== null) {
|
|
286
|
-
const obj = { ...input };
|
|
287
|
-
if (typeof obj.description === 'string' && !obj.type) {
|
|
288
|
-
try {
|
|
289
|
-
const parsed = JSON.parse(obj.description);
|
|
290
|
-
if (parsed && typeof parsed === 'object' && parsed.type) {
|
|
291
|
-
return parsed;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
catch { }
|
|
295
|
-
}
|
|
296
|
-
if (typeof obj.options === 'string') {
|
|
297
|
-
try {
|
|
298
|
-
obj.options = JSON.parse(obj.options);
|
|
299
|
-
}
|
|
300
|
-
catch { }
|
|
301
|
-
}
|
|
302
|
-
return obj;
|
|
303
|
-
}
|
|
304
|
-
return input;
|
|
305
|
-
}, z.discriminatedUnion("type", [
|
|
306
|
-
z.object({
|
|
307
|
-
type: z.literal("generate"),
|
|
308
|
-
options: WipGenerationOptionsSchema.describe("WIP generation options"),
|
|
309
|
-
outputPath: z.string().describe("Output file path (.wip file). If file exists, it will be overwritten"),
|
|
310
|
-
}).describe("Generate WIP file from markdown text and optional images"),
|
|
311
|
-
z.object({
|
|
312
|
-
type: z.literal("verify"),
|
|
313
|
-
wipFilePath: z.string().describe("WIP file path to verify. Supports: 1) Local file path (e.g., '/path/to/file.wip', 'C:\\Users\\name\\doc.wip'), 2) Network URL (e.g., 'https://example.com/doc.wip', 'http://site.com/file.wip'), 3) Data URL (e.g., 'data:application/json;base64,eyJ3aXAiOi...')"),
|
|
314
|
-
hash_equal: z.string().optional().describe("Optional expected hash value. If provided, the function will first verify if the file's hash matches this value. If not matched, returns hash mismatch error."),
|
|
315
|
-
requireSignature: z.boolean().optional().describe("Optional flag to require digital signature. If true, verification will fail if WIP file has no signature"),
|
|
316
|
-
}).describe("Verify WIP file integrity and signatures"),
|
|
317
|
-
z.object({
|
|
318
|
-
type: z.literal("sign"),
|
|
319
|
-
wipFilePath: z.string().describe("WIP file path to sign. Supports: 1) Local file path (e.g., '/path/to/file.wip'), 2) Network URL (e.g., 'https://example.com/doc.wip'). The file will be loaded, validated, and signed"),
|
|
320
|
-
account: z.string().optional().describe("Signing account (account name or address). If not specified, uses default account"),
|
|
321
|
-
outputPath: z.string().optional().describe("Output file path. If not specified, adds 'signed_' prefix to original file name (e.g., 'doc.wip' becomes 'signed_doc.wip')"),
|
|
322
|
-
}).describe("Sign WIP file with account"),
|
|
323
|
-
z.object({
|
|
324
|
-
type: z.literal("wip2html"),
|
|
325
|
-
wipPath: z.string().describe("WIP file path or directory path. Supports: 1) Single WIP file (e.g., '/path/to/file.wip'), 2) Directory containing .wip files (e.g., '/path/to/wips/'), 3) Network URL (e.g., 'https://example.com/doc.wip'). When directory is provided, all .wip files in the directory will be converted to HTML"),
|
|
326
|
-
options: WipToHtmlOptionsSchema.optional().describe("Conversion options"),
|
|
327
|
-
}).describe("Convert WIP file to HTML format"),
|
|
328
|
-
]));
|
|
329
|
-
const OnchainTableDataSchema = z.preprocess((input) => {
|
|
330
|
-
if (typeof input === 'object' && input !== null && !Array.isArray(input)) {
|
|
331
|
-
const obj = { ...input };
|
|
332
|
-
if (typeof obj.description === 'string' && !obj.query_type) {
|
|
333
|
-
try {
|
|
334
|
-
const parsed = JSON.parse(obj.description);
|
|
335
|
-
if (parsed && typeof parsed === 'object' && parsed.query_type) {
|
|
336
|
-
return parsed;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
catch { }
|
|
340
|
-
}
|
|
341
|
-
if (obj.cursor === '')
|
|
342
|
-
obj.cursor = null;
|
|
343
|
-
if (obj.limit === '')
|
|
344
|
-
obj.limit = null;
|
|
345
|
-
return obj;
|
|
346
|
-
}
|
|
347
|
-
return input;
|
|
348
|
-
}, z.union([
|
|
349
|
-
z.discriminatedUnion("query_type", [
|
|
350
|
-
z.object({
|
|
351
|
-
query_type: z.literal("onchain_table"),
|
|
352
|
-
parent: NameOrAddressSchema.describe("Parent object ID whose dynamic fields table to query"),
|
|
353
|
-
cursor: z.union([z.string(), z.null()]).optional().describe("Pagination cursor from previous page's nextCursor"),
|
|
354
|
-
limit: z.union([z.number(), z.null()]).optional().describe("Max items per page"),
|
|
355
|
-
no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
|
|
356
|
-
network: EntrypointSchema.optional(),
|
|
357
|
-
}).describe("Paginated query of an on-chain object's dynamic fields table — returns items with keys, types, and object IDs. Use to explore all entries (e.g., all orders in a Service, all records in a Repository). Returns: TableAnswer | undefined (items[], nextCursor, hasNextPage)"),
|
|
358
|
-
z.object({
|
|
359
|
-
query_type: z.literal("onchain_table_item_repository_data"),
|
|
360
|
-
parent: NameOrAddressSchema.describe("Parent Repository object ID"),
|
|
361
|
-
name: z.string().describe("Name/key of the record to retrieve from the repository"),
|
|
362
|
-
entity: z.union([AccountOrMark_AddressSchema, z.number()]).describe("Entity ID or address that owns/identifies the record"),
|
|
363
|
-
no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
|
|
364
|
-
network: EntrypointSchema.optional(),
|
|
365
|
-
}).describe("Query a specific record from a Repository's on-chain key-value database by name and entity. Use to read stored data records. Returns: TableItem_RepositoryData | undefined"),
|
|
366
|
-
z.object({
|
|
367
|
-
query_type: z.literal("onchain_table_item_permission_perm"),
|
|
368
|
-
parent: NameOrAddressSchema.describe("Parent Permission object ID"),
|
|
369
|
-
address: z.union([AccountOrMark_AddressSchema, z.string()]).describe("User address or Guard ID whose permissions to check"),
|
|
370
|
-
no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
|
|
371
|
-
network: EntrypointSchema.optional(),
|
|
372
|
-
}).describe("Query a permission entry from a Permission object's perm table — checks what operations a user/guard is allowed to perform. Use to verify access rights. Returns: TableItem_PermissionPerm | undefined"),
|
|
373
|
-
z.object({
|
|
374
|
-
query_type: z.literal("onchain_table_item_entity_registrar"),
|
|
375
|
-
address: z.union([AccountOrMark_AddressSchema, z.string()]).describe("User address to look up in the global EntityRegistrar"),
|
|
376
|
-
no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
|
|
377
|
-
network: EntrypointSchema.optional(),
|
|
378
|
-
}).describe("Query an entity's registration record from the global EntityRegistrar — verifies if an address is registered on the blockchain. Use to check registration status and details. Returns: TableItem_EntityRegistrar | undefined"),
|
|
379
|
-
z.object({
|
|
380
|
-
query_type: z.literal("onchain_table_item_entity_linker"),
|
|
381
|
-
address: z.union([AccountOrMark_AddressSchema, z.string()]).describe("Entity address whose community votes/endorsements to query"),
|
|
382
|
-
no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
|
|
383
|
-
network: EntrypointSchema.optional(),
|
|
384
|
-
}).describe("Query community votes/endorsements for an entity from the global EntityLinker — shows how others have voted on this entity. Use to check reputation and community trust. Returns: TableItem_EntityLinker | undefined"),
|
|
385
|
-
z.object({
|
|
386
|
-
query_type: z.literal("onchain_table_item_reward_record"),
|
|
387
|
-
parent: NameOrAddressSchema.describe("Parent Reward object ID"),
|
|
388
|
-
address: AccountOrMark_AddressSchema.describe("User address that claimed the reward"),
|
|
389
|
-
no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
|
|
390
|
-
network: EntrypointSchema.optional(),
|
|
391
|
-
}).describe("Query a reward claim record from a Reward object's table — checks if a user has claimed a specific incentive. Use to verify reward distribution status. Returns: TableItem_RewardRecord | undefined"),
|
|
392
|
-
]),
|
|
393
|
-
z.discriminatedUnion("query_type", [
|
|
394
|
-
z.object({
|
|
395
|
-
query_type: z.literal("onchain_table_item_demand_presenter"),
|
|
396
|
-
parent: NameOrAddressSchema.describe("Parent Demand object ID"),
|
|
397
|
-
address: AccountOrMark_AddressSchema.describe("Presenter address that submitted the demand"),
|
|
398
|
-
no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
|
|
399
|
-
network: EntrypointSchema.optional(),
|
|
400
|
-
}).describe("Query a demand submission from a Demand object's table — Demands are service requests submitted by users. Use to check a specific demand's details. Returns: TableItem_DemandPresenter | undefined"),
|
|
401
|
-
z.object({
|
|
402
|
-
query_type: z.literal("onchain_table_item_treasury_history"),
|
|
403
|
-
parent: NameOrAddressSchema.describe("Parent Treasury object ID"),
|
|
404
|
-
address: AccountOrMark_AddressSchema.describe("Payment ID whose treasury record to look up"),
|
|
405
|
-
no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
|
|
406
|
-
network: EntrypointSchema.optional(),
|
|
407
|
-
}).describe("Query a payment record from a Treasury's history table by payment ID — Treasury manages funds and payment tracking. Use to look up payment details and status. Returns: TableItem_TreasuryHistory | undefined"),
|
|
408
|
-
z.object({
|
|
409
|
-
query_type: z.literal("onchain_table_item_machine_node"),
|
|
410
|
-
parent: NameOrAddressSchema.describe("Parent Machine object ID"),
|
|
411
|
-
key: z.string().describe("Node name (string key) to query in the Machine's workflow definition"),
|
|
412
|
-
no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
|
|
413
|
-
network: EntrypointSchema.optional(),
|
|
414
|
-
}).describe("Query a workflow node definition from a Machine object's table by node name — Machines define workflow templates. Use to inspect a specific node's configuration and logic. Returns: TableItem_MachineNode | undefined"),
|
|
415
|
-
z.object({
|
|
416
|
-
query_type: z.literal("onchain_table_item_progress_history"),
|
|
417
|
-
parent: NameOrAddressSchema.describe("Parent Progress object ID"),
|
|
418
|
-
u64: z.union([z.number(), z.string()]).describe("Sequence number (u64) of the progress step to query"),
|
|
419
|
-
no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
|
|
420
|
-
network: EntrypointSchema.optional(),
|
|
421
|
-
}).describe("Query a progress step record from a Progress object's table by sequence number — Progress tracks order/workflow execution. Use to check the status of a specific execution step. Returns: TableItem_ProgressHistory | undefined"),
|
|
422
|
-
z.object({
|
|
423
|
-
query_type: z.literal("onchain_table_item_address_mark"),
|
|
424
|
-
parent: NameOrAddressSchema.describe("Parent AddressMark object ID"),
|
|
425
|
-
address: AccountOrMark_AddressSchema.describe("Address whose PUBLIC on-chain name/tags to look up"),
|
|
426
|
-
no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
|
|
427
|
-
network: EntrypointSchema.optional(),
|
|
428
|
-
}).describe("Query a PUBLIC on-chain name/tag mark for an address — unlike local marks, these are published on-chain. Use to look up public labels attached to any address. Returns: TableItem_AddressMark | undefined"),
|
|
429
|
-
z.object({
|
|
430
|
-
query_type: z.literal("onchain_table_item_generic"),
|
|
431
|
-
parent: NameOrAddressSchema.describe("Parent object ID whose dynamic field to query"),
|
|
432
|
-
key_type: z.string().describe("Type of the key (e.g., 'address', 'u64', 'string', '0x2::object::ID')"),
|
|
433
|
-
key_value: z.any().describe("Value of the key. Must match the key_type format"),
|
|
434
|
-
no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
|
|
435
|
-
network: EntrypointSchema.optional(),
|
|
436
|
-
}).describe("Query a generic table item from ANY object's dynamic fields — supports arbitrary key types and values for non-WoWok objects. Use for custom objects and general-purpose table lookups. Returns: ObjectBase | undefined"),
|
|
437
|
-
]),
|
|
438
|
-
]));
|
|
439
|
-
const OnchainTableDataResultSchema = z.object({
|
|
440
|
-
result: z.union([
|
|
441
|
-
z.object({ query_type: z.literal("onchain_table"), result: z.union([TableAnswerSchema, z.undefined()]) }),
|
|
442
|
-
z.object({ query_type: z.literal("onchain_table_item_repository_data"), result: z.union([TableItem_RepositoryDataSchema, z.undefined()]) }),
|
|
443
|
-
z.object({ query_type: z.literal("onchain_table_item_permission_perm"), result: z.union([TableItem_PermissionPermSchema, z.undefined()]) }),
|
|
444
|
-
z.object({ query_type: z.literal("onchain_table_item_entity_registrar"), result: z.union([TableItem_EntityRegistrarSchema, z.undefined()]) }),
|
|
445
|
-
z.object({ query_type: z.literal("onchain_table_item_entity_linker"), result: z.union([TableItem_EntityLinkerSchema, z.undefined()]) }),
|
|
446
|
-
z.object({ query_type: z.literal("onchain_table_item_reward_record"), result: z.union([TableItem_RewardRecordSchema, z.undefined()]) }),
|
|
447
|
-
z.object({ query_type: z.literal("onchain_table_item_demand_presenter"), result: z.union([TableItem_DemandPresenterSchema, z.undefined()]) }),
|
|
448
|
-
z.object({ query_type: z.literal("onchain_table_item_treasury_history"), result: z.union([TableItem_TreasuryHistorySchema, z.undefined()]) }),
|
|
449
|
-
z.object({ query_type: z.literal("onchain_table_item_machine_node"), result: z.union([TableItem_MachineNodeSchema, z.undefined()]) }),
|
|
450
|
-
z.object({ query_type: z.literal("onchain_table_item_progress_history"), result: z.union([TableItem_ProgressHistorySchema, z.undefined()]) }),
|
|
451
|
-
z.object({ query_type: z.literal("onchain_table_item_address_mark"), result: z.union([TableItem_AddressMarkSchema, z.undefined()]) }),
|
|
452
|
-
z.object({ query_type: z.literal("onchain_table_item_generic"), result: z.union([ObjectBaseSchema, z.undefined()]) }),
|
|
453
|
-
])
|
|
454
|
-
});
|
|
455
152
|
async function handleOnchainTableData(args) {
|
|
456
153
|
const validated = strictParse(OnchainTableDataSchema, args, "onchain_table_data input");
|
|
457
154
|
let result;
|
|
@@ -529,90 +226,6 @@ async function handleOnchainTableData(args) {
|
|
|
529
226
|
structuredContent: { result },
|
|
530
227
|
};
|
|
531
228
|
}
|
|
532
|
-
const WatchQueryOperationsSchema = z.preprocess((input) => {
|
|
533
|
-
if (typeof input === 'object' && input !== null) {
|
|
534
|
-
const obj = { ...input };
|
|
535
|
-
if (typeof obj.description === 'string' && !obj.query_type) {
|
|
536
|
-
try {
|
|
537
|
-
const parsed = JSON.parse(obj.description);
|
|
538
|
-
if (parsed && typeof parsed === 'object' && parsed.query_type) {
|
|
539
|
-
return parsed;
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
catch { }
|
|
543
|
-
}
|
|
544
|
-
for (const key of ['filter', 'objects', 'env', 'token_type']) {
|
|
545
|
-
if (typeof obj[key] === 'string') {
|
|
546
|
-
try {
|
|
547
|
-
obj[key] = JSON.parse(obj[key]);
|
|
548
|
-
}
|
|
549
|
-
catch { }
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
return obj;
|
|
553
|
-
}
|
|
554
|
-
return input;
|
|
555
|
-
}, z.union([
|
|
556
|
-
z.discriminatedUnion("query_type", [
|
|
557
|
-
z.object({
|
|
558
|
-
query_type: z.literal("local_mark_list"),
|
|
559
|
-
filter: LocalMarkFilterSchema.optional().describe("Local mark filter"),
|
|
560
|
-
}).describe("Query your LOCAL address book — maps human-readable names to blockchain addresses with optional tags. Use to resolve names→addresses or find addresses by tag. Returns: MarkData[] (name, address, tags, timestamps)"),
|
|
561
|
-
z.object({
|
|
562
|
-
query_type: z.literal("account_list"),
|
|
563
|
-
filter: AccountFilterSchema.optional().describe("Account filter"),
|
|
564
|
-
}).describe("Query your LOCAL accounts — view all accounts stored on this device (addresses, public keys, messenger status, suspension state). Use to discover available accounts before operations. Returns: AccountData[] (name, address, pubkey, suspended, messenger, timestamps)"),
|
|
565
|
-
z.object({
|
|
566
|
-
query_type: z.literal("local_info_list"),
|
|
567
|
-
filter: LocalInfoFilterSchema.optional().describe("Local info filter"),
|
|
568
|
-
}).describe("Query your LOCAL private info — sensitive data like delivery addresses, phone numbers, contacts stored ONLY on this device. Use to retrieve saved contact/delivery details. Returns: InfoData[] (name, default value, contents, timestamps)"),
|
|
569
|
-
z.object({
|
|
570
|
-
query_type: z.literal("token_list"),
|
|
571
|
-
filter: TokenDataFilterSchema.optional(),
|
|
572
|
-
}).describe("Query cached token metadata — symbol, decimals, icon URL, description for tokens previously fetched from chain. Use to look up token info without an on-chain query. Returns: TokenTypeInfo[] (type, alias, name, symbol, decimals, iconUrl)"),
|
|
573
|
-
z.object({
|
|
574
|
-
query_type: z.literal("account_balance"),
|
|
575
|
-
name_or_address: NameOrAddressSchema.optional().describe("Account name or address. Use empty string '' for the default account. Defaults to '' if omitted."),
|
|
576
|
-
balance: z.boolean().optional().describe("Set to true to query total balance amount for the token type"),
|
|
577
|
-
coin: z.object({
|
|
578
|
-
cursor: z.union([z.string(), z.null()]).optional().describe("Pagination cursor for listing coin objects"),
|
|
579
|
-
limit: z.union([z.number(), z.null()]).optional().describe("Max coin objects per page"),
|
|
580
|
-
}).optional().describe("Set to query paginated coin objects instead of balance. Use cursor/limit for pagination."),
|
|
581
|
-
token_type: TokenTypeSchema.optional().describe("Token type to query; defaults to 0x2::wow::WOW (platform token)"),
|
|
582
|
-
network: EntrypointSchema.optional(),
|
|
583
|
-
}).describe("Query an account's coin balance OR paginated coin objects. Use balance=true for total amount, or coin={cursor,limit} to list individual coin objects. Returns: { address, balance? | coin? }"),
|
|
584
|
-
z.object({
|
|
585
|
-
query_type: z.literal("local_names"),
|
|
586
|
-
addresses: z.array(z.string()).describe("Array of addresses to look up local names for"),
|
|
587
|
-
}).describe("Query local names (account name and local mark name) for a list of addresses. Returns array of: { account?: string, local_mark?: string, address: string }"),
|
|
588
|
-
]),
|
|
589
|
-
z.discriminatedUnion("query_type", [
|
|
590
|
-
z.object({
|
|
591
|
-
query_type: z.literal("onchain_personal_profile"),
|
|
592
|
-
account: NameOrAddressSchema.optional().describe("Account name or ID to query. Use empty string '' for the default account."),
|
|
593
|
-
no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
|
|
594
|
-
network: EntrypointSchema.optional(),
|
|
595
|
-
}).describe("Query any user's PUBLIC on-chain profile — social links, reputation (likes/dislikes), personal info records, voting history, referrer. Use to look up a user's public identity and reputation. Returns: ObjectPersonal | undefined"),
|
|
596
|
-
z.object({
|
|
597
|
-
query_type: z.literal("onchain_objects"),
|
|
598
|
-
objects: z.array(NameOrAddressSchema).describe("List of object IDs (names or addresses) to query in batch"),
|
|
599
|
-
no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
|
|
600
|
-
network: EntrypointSchema.optional(),
|
|
601
|
-
}).describe("Batch query on-chain WOWOK objects by ID or name — supports Service, Machine, Order, Treasury, Reward, Arb, Personal, Contact, and more. Use to inspect one or more objects in a single call. Returns: { objects: ObjectBase[] }"),
|
|
602
|
-
z.object({
|
|
603
|
-
query_type: z.literal("onchain_received"),
|
|
604
|
-
name_or_address: AccountOrMark_AddressAISchema.describe("Name or address of the object that received payments/items - can be a string (name/address) or full object"),
|
|
605
|
-
type: z.union([z.string(), z.literal("CoinWrapper"), z.null()]).optional().describe("Type filter for querying received objects. " +
|
|
606
|
-
"- If undefined or null: query all types (equivalent to the old all_type=true). " +
|
|
607
|
-
"- If 'CoinWrapper': query CoinWrapper type for the object's token (equivalent to the old all_type=false). " +
|
|
608
|
-
"- If string: query specific StructType (e.g., '0x2::payment::CoinWrapper<0x2::wow::WOW>')."),
|
|
609
|
-
cursor: z.union([z.string(), z.null()]).optional().describe("Pagination cursor from previous page"),
|
|
610
|
-
limit: z.union([z.number(), z.null()]).optional().describe("Max records per page"),
|
|
611
|
-
no_cache: z.boolean().optional().describe("Set to true to bypass cache and fetch fresh on-chain data"),
|
|
612
|
-
network: EntrypointSchema.optional(),
|
|
613
|
-
}).describe("Query objects (Payments, Tokens, NFTs) received by a specific object. Use to track incoming payments or items sent to an on-chain object. Supports pagination and type filter. Returns: ReceivedBalance | ReceivedNormal[]"),
|
|
614
|
-
]),
|
|
615
|
-
]));
|
|
616
229
|
async function handleOnchainOperations(args) {
|
|
617
230
|
try {
|
|
618
231
|
if (typeof args === 'object' && args !== null && args.description && !args.operation_type) {
|
|
@@ -1456,19 +1069,20 @@ async function main() {
|
|
|
1456
1069
|
"Always check the schema before calling an unfamiliar tool.\n\n" +
|
|
1457
1070
|
"Actions:\n" +
|
|
1458
1071
|
" 'list' - Show all available schemas (tools + on-chain operations). Start here to discover what exists.\n" +
|
|
1459
|
-
" 'get' - Fetch the full JSON Schema by name (e.g. 'onchain_operations'). Use with the 'name' param.\n" +
|
|
1072
|
+
" 'get' - Fetch the full input JSON Schema by name (e.g. 'onchain_operations'). Use with the 'name' param.\n" +
|
|
1073
|
+
" 'get_output' - Fetch the output JSON Schema of a tool by name (e.g. 'onchain_operations'). Use with the 'name' param. Use this to understand a tool's return value structure.\n" +
|
|
1460
1074
|
" 'search' - Find schemas by keyword, matching name/title/description. Use with the 'query' param.\n" +
|
|
1461
1075
|
" 'list_operations' - Show only on-chain operation schemas (prefixed 'onchain_operations_'). Narrower than 'list'.",
|
|
1462
1076
|
inputSchema: z.object({
|
|
1463
|
-
action: z.enum(["list", "get", "search", "list_operations"])
|
|
1464
|
-
.describe("Action to perform: 'list' to see all available schemas, 'get' to retrieve a specific schema, 'search' to find schemas by keyword, 'list_operations' to list all on-chain operations"),
|
|
1465
|
-
name: z.string().optional().describe("Schema name for 'get' action (e.g., 'onchain_operations', 'account_operation', 'onchain_operations_permission')"),
|
|
1077
|
+
action: z.enum(["list", "get", "get_output", "search", "list_operations"])
|
|
1078
|
+
.describe("Action to perform: 'list' to see all available schemas, 'get' to retrieve a specific input schema, 'get_output' to retrieve a tool's output schema, 'search' to find schemas by keyword, 'list_operations' to list all on-chain operations"),
|
|
1079
|
+
name: z.string().optional().describe("Schema/tool name for 'get'/'get_output' action (e.g., 'onchain_operations', 'account_operation', 'onchain_operations_permission')"),
|
|
1466
1080
|
query: z.string().optional().describe("Search query for 'search' action"),
|
|
1467
1081
|
}),
|
|
1468
1082
|
outputSchema: z.object({
|
|
1469
1083
|
success: z.boolean().describe("Whether the request was successful"),
|
|
1470
1084
|
action: z.string().describe("The action that was performed"),
|
|
1471
|
-
data: z.any().describe("Response data - JSON Schema object for 'get', array of schema info for 'list'/'search'/'list_operations'"),
|
|
1085
|
+
data: z.any().describe("Response data - JSON Schema object for 'get'/'get_output', array of schema info for 'list'/'search'/'list_operations'"),
|
|
1472
1086
|
message: z.string().describe("Human-readable message describing the result"),
|
|
1473
1087
|
suggestions: z.array(z.string()).optional().describe("Suggested next steps or alternatives"),
|
|
1474
1088
|
}),
|
|
@@ -1523,6 +1137,14 @@ async function main() {
|
|
|
1523
1137
|
textContent += "\n```\n";
|
|
1524
1138
|
}
|
|
1525
1139
|
break;
|
|
1140
|
+
case "get_output":
|
|
1141
|
+
if (data) {
|
|
1142
|
+
textContent += "\n\n## Output JSON Schema\n\n";
|
|
1143
|
+
textContent += "```json\n";
|
|
1144
|
+
textContent += JSON.stringify(data, null, 2);
|
|
1145
|
+
textContent += "\n```\n";
|
|
1146
|
+
}
|
|
1147
|
+
break;
|
|
1526
1148
|
case "search":
|
|
1527
1149
|
if (Array.isArray(data) && data.length > 0) {
|
|
1528
1150
|
textContent += `\n\nFound ${data.length} schemas matching '${args.query}':\n`;
|
|
@@ -1557,6 +1179,30 @@ async function main() {
|
|
|
1557
1179
|
structuredContent: response,
|
|
1558
1180
|
};
|
|
1559
1181
|
});
|
|
1182
|
+
server.registerTool("bridge_operation", {
|
|
1183
|
+
title: "🌉 Bridge - Cross-Chain Operations",
|
|
1184
|
+
description: "🌉 Simplified cross-chain bridge between WOW and EVM (Ethereum mainnet). Only WOW mainnet provides cross-chain functionality.\n\n" +
|
|
1185
|
+
"Key concepts (transparent to user):\n" +
|
|
1186
|
+
" • Global single activeEvmAccount - auto-generated on first use, holds cross-chain assets.\n" +
|
|
1187
|
+
" • WOW→EVM: assets auto-claim to activeEvmAccount; optional withdrawTo transfers to a final EVM address.\n" +
|
|
1188
|
+
" • EVM→WOW: deposit from activeEvmAccount (balance checked first), assets arrive at the WOW account.\n\n" +
|
|
1189
|
+
"Operations (operation_type):\n" +
|
|
1190
|
+
" • cross_chain_wow_to_evm - WOW→EVM cross-chain (asset to activeEvmAccount or withdrawTo). [Requires WOW mainnet env]\n" +
|
|
1191
|
+
" • cross_chain_evm_to_wow - EVM→WOW cross-chain (from activeEvmAccount to WOW account). [Requires WOW mainnet env]\n" +
|
|
1192
|
+
" • withdraw - Withdraw from activeEvmAccount to another EVM address (non-cross-chain). [No env needed]\n" +
|
|
1193
|
+
" • query_active_evm_account - Query activeEvmAccount address + balances (per chain or all). [No env needed]\n" +
|
|
1194
|
+
" • query_supported_evm_chains - List supported EVM chains (enum/description/chainId/RPC health). [No env needed]\n" +
|
|
1195
|
+
" • query_supported_tokens - List supported Bridge tokens per chain (WOW/EVM contract addresses, decimals, description). [No env needed]\n" +
|
|
1196
|
+
" • query_transfer_list - Query transfer history list with optional filters (status/direction/token/limit). [No env needed]\n" +
|
|
1197
|
+
" • query_transfer_status - Query single transfer detail by transferId. [No env needed]\n" +
|
|
1198
|
+
" • manage_evm_rpc - Manage EVM RPC endpoints (list/add/remove/set/ping) to handle 429 rate limits. [No env needed]\n\n" +
|
|
1199
|
+
"Token support follows SDK config (ETH/WETH/WBTC/USDC/USDT). WOW account names are supported (resolved via LocalMark).\n" +
|
|
1200
|
+
"NOTE: Use schema_query (name='bridge_operation') to retrieve the exact JSON Schema with all field definitions before calling.",
|
|
1201
|
+
inputSchema: BridgeOperationsSchema,
|
|
1202
|
+
outputSchema: BridgeCallOutputSchema,
|
|
1203
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true },
|
|
1204
|
+
_meta: createToolMeta("operation", ["bridge", "cross-chain", "evm", "ethereum", "wow", "transfer", "rpc"]),
|
|
1205
|
+
}, handleBridgeOperations);
|
|
1560
1206
|
const transport = new StdioServerTransport();
|
|
1561
1207
|
await server.connect(transport);
|
|
1562
1208
|
process.on("SIGINT", async () => {
|