@agledger/mcp-server 1.5.0 → 2.0.0

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 (66) hide show
  1. package/dist/api-client.d.ts +16 -0
  2. package/dist/api-client.d.ts.map +1 -0
  3. package/dist/api-client.js +52 -0
  4. package/dist/api-client.js.map +1 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +17 -58
  7. package/dist/index.js.map +1 -1
  8. package/dist/server.d.ts +2 -13
  9. package/dist/server.d.ts.map +1 -1
  10. package/dist/server.js +113 -109
  11. package/dist/server.js.map +1 -1
  12. package/package.json +2 -3
  13. package/src/api-client.ts +72 -0
  14. package/src/index.ts +27 -60
  15. package/src/server.ts +136 -120
  16. package/tests/api-client.test.ts +147 -0
  17. package/tests/harness.ts +8 -35
  18. package/tests/integration.test.ts +373 -0
  19. package/tests/server.test.ts +286 -0
  20. package/src/enums.ts +0 -47
  21. package/src/errors.ts +0 -44
  22. package/src/resources/contract-types.ts +0 -130
  23. package/src/tool-scopes.ts +0 -180
  24. package/src/tools/a2a.ts +0 -430
  25. package/src/tools/agent-mandates.ts +0 -259
  26. package/src/tools/agents-refs.ts +0 -232
  27. package/src/tools/capabilities.ts +0 -63
  28. package/src/tools/compliance.ts +0 -70
  29. package/src/tools/dashboard.ts +0 -64
  30. package/src/tools/disputes.ts +0 -121
  31. package/src/tools/enterprises.ts +0 -203
  32. package/src/tools/events.ts +0 -33
  33. package/src/tools/federation-admin.ts +0 -665
  34. package/src/tools/federation.ts +0 -587
  35. package/src/tools/health.ts +0 -30
  36. package/src/tools/mandates.ts +0 -264
  37. package/src/tools/openclaw.ts +0 -122
  38. package/src/tools/receipts.ts +0 -134
  39. package/src/tools/reputation.ts +0 -69
  40. package/src/tools/schemas.ts +0 -535
  41. package/src/tools/verification-keys.ts +0 -33
  42. package/src/tools/verification.ts +0 -59
  43. package/tests/conformance.test.ts +0 -197
  44. package/tests/conformance.ts +0 -65
  45. package/tests/mock-client.ts +0 -71
  46. package/tests/profiles.test.ts +0 -120
  47. package/tests/resources/contract-types.test.ts +0 -82
  48. package/tests/tools/a2a.test.ts +0 -213
  49. package/tests/tools/agent-mandates.test.ts +0 -196
  50. package/tests/tools/agents-refs.test.ts +0 -190
  51. package/tests/tools/capabilities.test.ts +0 -80
  52. package/tests/tools/compliance.test.ts +0 -123
  53. package/tests/tools/dashboard.test.ts +0 -111
  54. package/tests/tools/disputes.test.ts +0 -123
  55. package/tests/tools/enterprises.test.ts +0 -171
  56. package/tests/tools/events.test.ts +0 -56
  57. package/tests/tools/federation-admin.test.ts +0 -468
  58. package/tests/tools/federation.test.ts +0 -522
  59. package/tests/tools/health.test.ts +0 -56
  60. package/tests/tools/mandates.test.ts +0 -143
  61. package/tests/tools/openclaw.test.ts +0 -148
  62. package/tests/tools/receipts.test.ts +0 -157
  63. package/tests/tools/reputation.test.ts +0 -108
  64. package/tests/tools/schemas.test.ts +0 -374
  65. package/tests/tools/verification-keys.test.ts +0 -56
  66. package/tests/tools/verification.test.ts +0 -64
@@ -1,535 +0,0 @@
1
- import { z } from 'zod';
2
- import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
- import type { AgledgerClient } from '@agledger/sdk';
4
- import { apiErrorResult, toStructuredContent } from '../errors.js';
5
- import { ContractTypeEnum } from '../enums.js';
6
- import { toolMeta } from '../tool-scopes.js';
7
-
8
- /** Accepts both standard and custom contract type identifiers. */
9
- const ContractTypeString = z.string().describe('Contract type identifier (e.g., ACH-PROC-v1 or a custom type)');
10
-
11
- const FieldMappingValueType = z.enum(['number', 'denomination', 'string', 'boolean', 'datetime', 'expression'])
12
- .describe('Value type for field mapping. Use "expression" for expression-based verification rules');
13
-
14
- const FieldMappingSchema = z.object({
15
- ruleId: z.string().describe('Verification rule identifier'),
16
- criteriaPath: z.string().describe('JSON path to the mandate criteria field'),
17
- evidencePath: z.string().describe('JSON path to the receipt evidence field'),
18
- toleranceField: z.string().optional().describe('JSON path to the tolerance specification field'),
19
- valueType: FieldMappingValueType,
20
- expression: z.string().optional().describe('Safe expression string. Required when valueType is "expression"'),
21
- }).describe('Field mapping between mandate criteria and receipt evidence for verification');
22
-
23
- const CompatibilityModeEnum = z.enum(['FULL', 'BACKWARD', 'FORWARD', 'NONE'])
24
- .describe('Schema compatibility mode');
25
-
26
- export function registerSchemaTools(mcp: McpServer, client: AgledgerClient): void {
27
- mcp.registerTool(
28
- 'list_contract_schemas',
29
- {
30
- title: 'List Contract Schemas',
31
- description: 'List all AGLedger contract type identifiers (built-in and custom). Each type now includes quickStart examples. Start here when building a new schema — use the returned types as reference patterns, then call get_contract_schema on a similar type to see its structure and quickStart guide.',
32
- inputSchema: {},
33
- annotations: {
34
- readOnlyHint: true,
35
- destructiveHint: false,
36
- idempotentHint: true,
37
- openWorldHint: true,
38
- },
39
- _meta: toolMeta('list_contract_schemas'),
40
- },
41
- async () => {
42
- try {
43
- const result = await client.schemas.list();
44
- return {
45
- content: [],
46
- structuredContent: toStructuredContent({ contractTypes: result.data }),
47
- };
48
- } catch (err) {
49
- return apiErrorResult(err);
50
- }
51
- },
52
- );
53
-
54
- mcp.registerTool(
55
- 'get_contract_schema',
56
- {
57
- title: 'Get Contract Schema',
58
- description: 'Get the full JSON Schema for a contract type, including mandate/receipt schemas, verification rules, field mappings, and quickStart examples with copy-pasteable payloads. Use this to understand an existing type before creating a custom one.',
59
- inputSchema: {
60
- contractType: ContractTypeEnum.describe('Contract type to retrieve the schema for'),
61
- },
62
- annotations: {
63
- readOnlyHint: true,
64
- destructiveHint: false,
65
- idempotentHint: true,
66
- openWorldHint: true,
67
- },
68
- _meta: toolMeta('get_contract_schema'),
69
- },
70
- async (args) => {
71
- try {
72
- const schema = await client.schemas.get(args.contractType);
73
- return {
74
- content: [],
75
- structuredContent: toStructuredContent(schema),
76
- };
77
- } catch (err) {
78
- return apiErrorResult(err);
79
- }
80
- },
81
- );
82
-
83
- mcp.registerTool(
84
- 'get_meta_schema',
85
- {
86
- title: 'Get Meta-Schema',
87
- description: 'Get the meta-schema that defines constraints and limits for custom schema authoring (max depth, allowed formats, field mapping types, expression limits). Review this BEFORE designing a custom schema.',
88
- inputSchema: {},
89
- annotations: {
90
- readOnlyHint: true,
91
- destructiveHint: false,
92
- idempotentHint: true,
93
- openWorldHint: true,
94
- },
95
- _meta: toolMeta('get_meta_schema'),
96
- },
97
- async () => {
98
- try {
99
- const metaSchema = await client.schemas.getMetaSchema();
100
- return {
101
- content: [],
102
- structuredContent: toStructuredContent(metaSchema),
103
- };
104
- } catch (err) {
105
- return apiErrorResult(err);
106
- }
107
- },
108
- );
109
-
110
- mcp.registerTool(
111
- 'preview_schema',
112
- {
113
- title: 'Preview Schema',
114
- description: 'Preview and validate a custom contract type schema before registration. Returns validation errors (with examplePayload showing correct structure) or the compiled output. Supports expression-based field mappings in fieldMappings array.',
115
- inputSchema: {
116
- contractType: ContractTypeString.describe('Custom contract type identifier (e.g., ACH-CUSTOM-v1)'),
117
- displayName: z.string().describe('Human-readable name for the contract type'),
118
- description: z.string().optional().describe('Description of the contract type'),
119
- category: z.string().optional().describe('Category for the contract type'),
120
- mandateSchema: z.record(z.string(), z.unknown()).describe('JSON Schema for mandate criteria'),
121
- receiptSchema: z.record(z.string(), z.unknown()).describe('JSON Schema for receipt evidence'),
122
- fieldMappings: z.array(FieldMappingSchema).optional().describe('Field mappings for verification rules, including expression-based rules'),
123
- compatibilityMode: CompatibilityModeEnum.optional().describe('Compatibility mode for version evolution'),
124
- },
125
- annotations: {
126
- readOnlyHint: true,
127
- destructiveHint: false,
128
- idempotentHint: true,
129
- openWorldHint: true,
130
- },
131
- _meta: toolMeta('preview_schema'),
132
- },
133
- async (args) => {
134
- try {
135
- const result = await client.schemas.preview({
136
- contractType: args.contractType,
137
- displayName: args.displayName,
138
- description: args.description,
139
- category: args.category,
140
- mandateSchema: args.mandateSchema,
141
- receiptSchema: args.receiptSchema,
142
- fieldMappings: args.fieldMappings,
143
- compatibilityMode: args.compatibilityMode,
144
- });
145
- return {
146
- content: [],
147
- structuredContent: toStructuredContent(result),
148
- };
149
- } catch (err) {
150
- return apiErrorResult(err);
151
- }
152
- },
153
- );
154
-
155
- mcp.registerTool(
156
- 'register_schema',
157
- {
158
- title: 'Register Schema',
159
- description: 'Register a new custom contract type schema. Use preview_schema first to validate. Supports expression-based field mappings. On validation error, returns examplePayload with correct structure. Returns the created schema version detail on success.',
160
- inputSchema: {
161
- contractType: ContractTypeString.describe('Custom contract type identifier (e.g., ACH-CUSTOM-v1)'),
162
- displayName: z.string().describe('Human-readable name for the contract type'),
163
- description: z.string().optional().describe('Description of the contract type'),
164
- category: z.string().optional().describe('Category for the contract type'),
165
- mandateSchema: z.record(z.string(), z.unknown()).describe('JSON Schema for mandate criteria'),
166
- receiptSchema: z.record(z.string(), z.unknown()).describe('JSON Schema for receipt evidence'),
167
- fieldMappings: z.array(FieldMappingSchema).optional().describe('Field mappings for verification rules, including expression-based rules'),
168
- compatibilityMode: CompatibilityModeEnum.optional().describe('Compatibility mode for version evolution'),
169
- },
170
- annotations: {
171
- readOnlyHint: false,
172
- destructiveHint: false,
173
- idempotentHint: false,
174
- openWorldHint: true,
175
- },
176
- _meta: toolMeta('register_schema'),
177
- },
178
- async (args) => {
179
- try {
180
- const result = await client.schemas.register({
181
- contractType: args.contractType,
182
- displayName: args.displayName,
183
- description: args.description,
184
- category: args.category,
185
- mandateSchema: args.mandateSchema,
186
- receiptSchema: args.receiptSchema,
187
- fieldMappings: args.fieldMappings,
188
- compatibilityMode: args.compatibilityMode,
189
- });
190
- return {
191
- content: [],
192
- structuredContent: toStructuredContent(result),
193
- };
194
- } catch (err) {
195
- return apiErrorResult(err);
196
- }
197
- },
198
- );
199
-
200
- mcp.registerTool(
201
- 'get_schema_versions',
202
- {
203
- title: 'Get Schema Versions',
204
- description: 'List all versions of a contract type schema, including version numbers, status, compatibility mode, and timestamps.',
205
- inputSchema: {
206
- contractType: ContractTypeString.describe('Contract type to list versions for'),
207
- },
208
- annotations: {
209
- readOnlyHint: true,
210
- destructiveHint: false,
211
- idempotentHint: true,
212
- openWorldHint: true,
213
- },
214
- _meta: toolMeta('get_schema_versions'),
215
- },
216
- async (args) => {
217
- try {
218
- const page = await client.schemas.getVersions(args.contractType as Parameters<typeof client.schemas.getVersions>[0]);
219
- return {
220
- content: [],
221
- structuredContent: toStructuredContent({ contractType: args.contractType, versions: page.data }),
222
- };
223
- } catch (err) {
224
- return apiErrorResult(err);
225
- }
226
- },
227
- );
228
-
229
- mcp.registerTool(
230
- 'diff_schema_versions',
231
- {
232
- title: 'Diff Schema Versions',
233
- description: 'Compare two versions of a contract type schema. Shows added, removed, modified, and renamed fields in both mandate and receipt schemas.',
234
- inputSchema: {
235
- contractType: ContractTypeString.describe('Contract type to diff'),
236
- from: z.number().int().min(1).describe('Source version number'),
237
- to: z.number().int().min(1).describe('Target version number'),
238
- },
239
- annotations: {
240
- readOnlyHint: true,
241
- destructiveHint: false,
242
- idempotentHint: true,
243
- openWorldHint: true,
244
- },
245
- _meta: toolMeta('diff_schema_versions'),
246
- },
247
- async (args) => {
248
- try {
249
- const diff = await client.schemas.diff(
250
- args.contractType as Parameters<typeof client.schemas.diff>[0],
251
- args.from,
252
- args.to,
253
- );
254
- return {
255
- content: [],
256
- structuredContent: toStructuredContent(diff),
257
- };
258
- } catch (err) {
259
- return apiErrorResult(err);
260
- }
261
- },
262
- );
263
-
264
- mcp.registerTool(
265
- 'get_schema_template',
266
- {
267
- title: 'Get Schema Template',
268
- description: 'Get a starter template from an existing contract type. Use this to scaffold a new custom schema based on a similar built-in type. After getting the template, modify it and use preview_schema to validate.',
269
- inputSchema: {
270
- contractType: ContractTypeString.describe('Contract type to use as template (e.g. ACH-PROC-v1)'),
271
- },
272
- annotations: {
273
- readOnlyHint: true,
274
- destructiveHint: false,
275
- idempotentHint: true,
276
- openWorldHint: true,
277
- },
278
- _meta: toolMeta('get_schema_template'),
279
- },
280
- async (args) => {
281
- try {
282
- const template = await client.schemas.getTemplate(args.contractType as Parameters<typeof client.schemas.getTemplate>[0]);
283
- return {
284
- content: [],
285
- structuredContent: toStructuredContent(template),
286
- };
287
- } catch (err) {
288
- return apiErrorResult(err);
289
- }
290
- },
291
- );
292
-
293
- mcp.registerTool(
294
- 'get_blank_schema_template',
295
- {
296
- title: 'Get Blank Schema Template',
297
- description: 'Get a blank template for creating a custom contract type from scratch. Returns the minimal valid structure with placeholder fields. After filling in, use preview_schema to validate.',
298
- inputSchema: {},
299
- annotations: {
300
- readOnlyHint: true,
301
- destructiveHint: false,
302
- idempotentHint: true,
303
- openWorldHint: true,
304
- },
305
- _meta: toolMeta('get_blank_schema_template'),
306
- },
307
- async () => {
308
- try {
309
- const template = await client.schemas.getBlankTemplate();
310
- return {
311
- content: [],
312
- structuredContent: toStructuredContent(template),
313
- };
314
- } catch (err) {
315
- return apiErrorResult(err);
316
- }
317
- },
318
- );
319
-
320
- mcp.registerTool(
321
- 'check_schema_compatibility',
322
- {
323
- title: 'Check Schema Compatibility',
324
- description: 'Check if schema changes are backward/forward compatible with the existing version. Run this BEFORE register_schema to catch breaking changes early.',
325
- inputSchema: {
326
- contractType: ContractTypeString.describe('Contract type to check compatibility against'),
327
- mandateSchema: z.record(z.string(), z.unknown()).describe('Proposed mandate criteria JSON Schema'),
328
- receiptSchema: z.record(z.string(), z.unknown()).describe('Proposed receipt evidence JSON Schema'),
329
- },
330
- annotations: {
331
- readOnlyHint: true,
332
- destructiveHint: false,
333
- idempotentHint: true,
334
- openWorldHint: true,
335
- },
336
- _meta: toolMeta('check_schema_compatibility'),
337
- },
338
- async (args) => {
339
- try {
340
- const result = await client.schemas.checkCompatibility(
341
- args.contractType as Parameters<typeof client.schemas.checkCompatibility>[0],
342
- { mandateSchema: args.mandateSchema, receiptSchema: args.receiptSchema },
343
- );
344
- return {
345
- content: [],
346
- structuredContent: toStructuredContent(result),
347
- };
348
- } catch (err) {
349
- return apiErrorResult(err);
350
- }
351
- },
352
- );
353
-
354
- mcp.registerTool(
355
- 'get_schema_version',
356
- {
357
- title: 'Get Schema Version',
358
- description: 'Get a specific version of a contract type schema. Use get_schema_versions first to see available versions, then this to inspect a particular one.',
359
- inputSchema: {
360
- contractType: ContractTypeString.describe('Contract type to retrieve'),
361
- version: z.number().int().describe('Version number'),
362
- },
363
- annotations: {
364
- readOnlyHint: true,
365
- destructiveHint: false,
366
- idempotentHint: true,
367
- openWorldHint: true,
368
- },
369
- _meta: toolMeta('get_schema_version'),
370
- },
371
- async (args) => {
372
- try {
373
- const result = await client.schemas.getVersion(
374
- args.contractType as Parameters<typeof client.schemas.getVersion>[0],
375
- args.version,
376
- );
377
- return {
378
- content: [],
379
- structuredContent: toStructuredContent(result),
380
- };
381
- } catch (err) {
382
- return apiErrorResult(err);
383
- }
384
- },
385
- );
386
-
387
- mcp.registerTool(
388
- 'validate_receipt_schema',
389
- {
390
- title: 'Validate Receipt Schema',
391
- description: 'Dry-run validate receipt evidence against a contract type schema. Use this BEFORE calling submit_receipt to check if your evidence structure is correct.',
392
- inputSchema: {
393
- contractType: ContractTypeString.describe('Contract type to validate against (e.g., ACH-PROC-v1)'),
394
- evidence: z.record(z.string(), z.unknown()).describe('Evidence object to validate'),
395
- },
396
- annotations: {
397
- readOnlyHint: true,
398
- destructiveHint: false,
399
- idempotentHint: true,
400
- openWorldHint: true,
401
- },
402
- _meta: toolMeta('validate_receipt_schema'),
403
- },
404
- async (args) => {
405
- try {
406
- const result = await client.schemas.validateReceipt(
407
- args.contractType as Parameters<typeof client.schemas.validateReceipt>[0],
408
- args.evidence,
409
- );
410
- return {
411
- content: [],
412
- structuredContent: toStructuredContent(result),
413
- };
414
- } catch (err) {
415
- return apiErrorResult(err);
416
- }
417
- },
418
- );
419
-
420
- mcp.registerTool(
421
- 'get_schema_rules',
422
- {
423
- title: 'Get Schema Rules',
424
- description: 'Get verification rule IDs configured for a contract type. Rules define how mandate criteria are verified against receipt evidence.',
425
- inputSchema: {
426
- contractType: ContractTypeString.describe('Contract type to get rules for'),
427
- },
428
- annotations: {
429
- readOnlyHint: true,
430
- destructiveHint: false,
431
- idempotentHint: true,
432
- openWorldHint: true,
433
- },
434
- _meta: toolMeta('get_schema_rules'),
435
- },
436
- async (args) => {
437
- try {
438
- const result = await client.schemas.getRules(args.contractType as Parameters<typeof client.schemas.getRules>[0]);
439
- return {
440
- content: [],
441
- structuredContent: toStructuredContent(result),
442
- };
443
- } catch (err) {
444
- return apiErrorResult(err);
445
- }
446
- },
447
- );
448
-
449
- mcp.registerTool(
450
- 'delete_schema',
451
- {
452
- title: 'Delete Schema',
453
- description: 'Delete a custom contract type schema. Cannot delete built-in types.',
454
- inputSchema: {
455
- contractType: ContractTypeString.describe('Custom contract type identifier to delete'),
456
- },
457
- annotations: {
458
- readOnlyHint: false,
459
- destructiveHint: true,
460
- idempotentHint: true,
461
- openWorldHint: true,
462
- },
463
- _meta: toolMeta('delete_schema'),
464
- },
465
- async (args) => {
466
- try {
467
- const result = await client.schemas.delete(args.contractType);
468
- return {
469
- content: [],
470
- structuredContent: toStructuredContent(result),
471
- };
472
- } catch (err) {
473
- return apiErrorResult(err);
474
- }
475
- },
476
- );
477
-
478
- mcp.registerTool(
479
- 'export_schema',
480
- {
481
- title: 'Export Schema',
482
- description: 'Export a schema bundle for promotion to another environment.',
483
- inputSchema: {
484
- contractType: ContractTypeString.describe('Contract type to export'),
485
- },
486
- annotations: {
487
- readOnlyHint: true,
488
- destructiveHint: false,
489
- idempotentHint: true,
490
- openWorldHint: true,
491
- },
492
- _meta: toolMeta('export_schema'),
493
- },
494
- async (args) => {
495
- try {
496
- const bundle = await client.schemas.exportSchema(args.contractType);
497
- return {
498
- content: [],
499
- structuredContent: toStructuredContent(bundle),
500
- };
501
- } catch (err) {
502
- return apiErrorResult(err);
503
- }
504
- },
505
- );
506
-
507
- mcp.registerTool(
508
- 'import_schema',
509
- {
510
- title: 'Import Schema',
511
- description: 'Import a schema bundle from another environment.',
512
- inputSchema: {
513
- bundle: z.record(z.string(), z.unknown()).describe('Schema bundle object from export_schema'),
514
- },
515
- annotations: {
516
- readOnlyHint: false,
517
- destructiveHint: false,
518
- idempotentHint: true,
519
- openWorldHint: true,
520
- },
521
- _meta: toolMeta('import_schema'),
522
- },
523
- async (args) => {
524
- try {
525
- const result = await client.schemas.importSchema(args.bundle as any);
526
- return {
527
- content: [],
528
- structuredContent: toStructuredContent(result),
529
- };
530
- } catch (err) {
531
- return apiErrorResult(err);
532
- }
533
- },
534
- );
535
- }
@@ -1,33 +0,0 @@
1
- import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- import type { AgledgerClient } from '@agledger/sdk';
3
- import { apiErrorResult, toStructuredContent } from '../errors.js';
4
- import { toolMeta } from '../tool-scopes.js';
5
-
6
- export function registerVerificationKeysTools(mcp: McpServer, client: AgledgerClient): void {
7
- mcp.registerTool(
8
- 'list_verification_keys',
9
- {
10
- title: 'List Verification Keys',
11
- description:
12
- 'List all vault signing public keys (active and retired) for independent audit chain verification. ' +
13
- 'No authentication required. Use these keys to verify Ed25519 signatures on audit chain exports. ' +
14
- 'Next step: fetch an audit export with `export_mandate_audit` and verify signatures locally.',
15
- inputSchema: {},
16
- annotations: {
17
- readOnlyHint: true,
18
- destructiveHint: false,
19
- idempotentHint: true,
20
- openWorldHint: true,
21
- },
22
- _meta: toolMeta('list_verification_keys'),
23
- },
24
- async () => {
25
- try {
26
- const result = await client.verificationKeys.list();
27
- return { content: [], structuredContent: toStructuredContent(result) };
28
- } catch (err) {
29
- return apiErrorResult(err);
30
- }
31
- },
32
- );
33
- }
@@ -1,59 +0,0 @@
1
- import { z } from 'zod';
2
- import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
- import type { AgledgerClient } from '@agledger/sdk';
4
- import { apiErrorResult, toStructuredContent } from '../errors.js';
5
- import { toolMeta } from '../tool-scopes.js';
6
-
7
- export function registerVerificationTools(mcp: McpServer, client: AgledgerClient): void {
8
- mcp.registerTool(
9
- 'verify_mandate',
10
- {
11
- title: 'Verify Mandate',
12
- description: 'Trigger verification of a mandate against its submitted receipts. Runs all sync and async verification rules.',
13
- inputSchema: {
14
- mandateId: z.string().describe('UUID of the mandate to verify'),
15
- },
16
- annotations: {
17
- readOnlyHint: false,
18
- destructiveHint: false,
19
- idempotentHint: true,
20
- openWorldHint: true,
21
- },
22
- _meta: toolMeta('verify_mandate'),
23
- },
24
- async (args) => {
25
- try {
26
- const result = await client.verification.verify(args.mandateId);
27
- return { content: [], structuredContent: toStructuredContent(result) };
28
- } catch (err) {
29
- return apiErrorResult(err);
30
- }
31
- },
32
- );
33
-
34
- mcp.registerTool(
35
- 'get_verification_status',
36
- {
37
- title: 'Get Verification Status',
38
- description: 'Get the current verification status for a mandate, including phase 1/2 progress and pending rules.',
39
- inputSchema: {
40
- mandateId: z.string().describe('UUID of the mandate to check verification status for'),
41
- },
42
- annotations: {
43
- readOnlyHint: true,
44
- destructiveHint: false,
45
- idempotentHint: true,
46
- openWorldHint: true,
47
- },
48
- _meta: toolMeta('get_verification_status'),
49
- },
50
- async (args) => {
51
- try {
52
- const status = await client.verification.getStatus(args.mandateId);
53
- return { content: [], structuredContent: toStructuredContent(status) };
54
- } catch (err) {
55
- return apiErrorResult(err);
56
- }
57
- },
58
- );
59
- }