@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,374 +0,0 @@
1
- import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest';
2
- import { registerSchemaTools } from '../../src/tools/schemas.js';
3
- import { createTestHarness, type TestHarness } from '../harness.js';
4
- import { assertErrorResult, assertSuccessResult } from '../conformance.js';
5
-
6
- const MOCK_SCHEMA = {
7
- contractType: 'ACH-PROC-v1',
8
- mandateSchema: { type: 'object', properties: { item: { type: 'string' } } },
9
- receiptSchema: { type: 'object', properties: { delivered: { type: 'boolean' } } },
10
- rulesConfig: { syncRuleIds: ['quantity-match'], asyncRuleIds: [] },
11
- fieldMappings: [],
12
- quickStart: {
13
- criteria: { item: 'widget', quantity: 10 },
14
- evidence: { delivered: true, quantity: 10 },
15
- },
16
- };
17
-
18
- const MOCK_META_SCHEMA = {
19
- constraints: { maxDepth: 5, maxNodes: 200, maxSizeBytes: 65536, maxCombinerEntries: 10, rootTypeMustBe: 'object', rootMustHaveRequired: true, blockedKeywords: ['$ref'] },
20
- allowedFormats: ['date-time', 'uri', 'email'],
21
- allowedRefs: [],
22
- limits: { contractTypeMaxLength: 64, maxFieldMappings: 20, ruleIdPattern: '^[a-z-]+$', ruleIdMaxLength: 64, reservedPrefixes: ['ACH-'] },
23
- fieldMappingValueTypes: ['number', 'denomination', 'string', 'boolean', 'datetime', 'expression'],
24
- builtinRuleIds: ['quantity-match', 'amount-match'],
25
- sharedSchemas: {},
26
- examples: { minimalMandate: {}, minimalReceipt: {} },
27
- };
28
-
29
- const MOCK_VERSION = {
30
- id: 'sv-1',
31
- contractType: 'ACH-CUSTOM-v1',
32
- version: 1,
33
- enterpriseId: null,
34
- displayName: 'Custom Type',
35
- description: 'A custom type',
36
- category: 'custom',
37
- compatibilityMode: 'FULL',
38
- status: 'ACTIVE',
39
- isBuiltin: false,
40
- createdAt: '2026-04-13T00:00:00Z',
41
- updatedAt: '2026-04-13T00:00:00Z',
42
- };
43
-
44
- const MOCK_DIFF = {
45
- contractType: 'ACH-CUSTOM-v1',
46
- from: { version: 1, createdAt: '2026-04-01T00:00:00Z', status: 'DEPRECATED' },
47
- to: { version: 2, createdAt: '2026-04-13T00:00:00Z', status: 'ACTIVE' },
48
- mandate: { changes: [{ type: 'added', path: '/properties/newField' }] },
49
- receipt: { changes: [] },
50
- };
51
-
52
- describe('schema tools', () => {
53
- let harness: TestHarness;
54
-
55
- const EXPECTED_TOOLS = [
56
- 'check_schema_compatibility', 'delete_schema', 'diff_schema_versions',
57
- 'export_schema', 'get_blank_schema_template', 'get_contract_schema',
58
- 'get_meta_schema', 'get_schema_rules', 'get_schema_template',
59
- 'get_schema_version', 'get_schema_versions', 'import_schema',
60
- 'list_contract_schemas', 'preview_schema', 'register_schema',
61
- 'validate_receipt_schema',
62
- ];
63
-
64
- beforeAll(async () => {
65
- harness = await createTestHarness({
66
- registerFns: [registerSchemaTools],
67
- mockOverrides: {
68
- schemas: {
69
- list: vi.fn().mockResolvedValue({ data: ['ACH-PROC-v1', 'ACH-DLVR-v1'] }),
70
- get: vi.fn().mockResolvedValue(MOCK_SCHEMA),
71
- getMetaSchema: vi.fn().mockResolvedValue(MOCK_META_SCHEMA),
72
- preview: vi.fn().mockResolvedValue({ valid: true, compiled: {} }),
73
- register: vi.fn().mockResolvedValue(MOCK_VERSION),
74
- getVersions: vi.fn().mockResolvedValue({ data: [MOCK_VERSION], hasMore: false }),
75
- diff: vi.fn().mockResolvedValue(MOCK_DIFF),
76
- getTemplate: vi.fn().mockResolvedValue({ contractType: 'ACH-PROC-v1', mandateSchema: {}, receiptSchema: {} }),
77
- getBlankTemplate: vi.fn().mockResolvedValue({ contractType: '', mandateSchema: {}, receiptSchema: {} }),
78
- checkCompatibility: vi.fn().mockResolvedValue({ compatible: true, issues: [] }),
79
- getVersion: vi.fn().mockResolvedValue(MOCK_VERSION),
80
- getRules: vi.fn().mockResolvedValue({ syncRuleIds: ['quantity-match'], asyncRuleIds: ['async-check'] }),
81
- validateReceipt: vi.fn().mockResolvedValue({ valid: true }),
82
- delete: vi.fn().mockResolvedValue({ deleted: true }),
83
- exportSchema: vi.fn().mockResolvedValue({ bundle: { contractType: 'ACH-CUSTOM-v1' } }),
84
- importSchema: vi.fn().mockResolvedValue({ imported: true }),
85
- },
86
- },
87
- });
88
- });
89
-
90
- afterAll(async () => { await harness.cleanup(); });
91
-
92
- it('registers exactly 16 tools', async () => {
93
- const { tools } = await harness.client.listTools();
94
- expect(tools.map((t: any) => t.name).sort()).toEqual(EXPECTED_TOOLS);
95
- });
96
-
97
- describe('list_contract_schemas', () => {
98
- it('returns list of contract types', async () => {
99
- const result = await harness.client.callTool({ name: 'list_contract_schemas', arguments: {} });
100
- assertSuccessResult(result as any);
101
- });
102
-
103
- it('returns error on failure', async () => {
104
- (harness.mockSdk.schemas as any).list.mockRejectedValueOnce(new Error('Unavailable'));
105
- const result = await harness.client.callTool({ name: 'list_contract_schemas', arguments: {} });
106
- assertErrorResult(result as any);
107
- });
108
- });
109
-
110
- describe('get_contract_schema', () => {
111
- it('returns schema details', async () => {
112
- const result = await harness.client.callTool({ name: 'get_contract_schema', arguments: { contractType: 'ACH-PROC-v1' } });
113
- assertSuccessResult(result as any);
114
- });
115
-
116
- it('returns error on failure', async () => {
117
- (harness.mockSdk.schemas as any).get.mockRejectedValueOnce(new Error('Not found'));
118
- const result = await harness.client.callTool({ name: 'get_contract_schema', arguments: { contractType: 'ACH-PROC-v1' } });
119
- assertErrorResult(result as any);
120
- });
121
- });
122
-
123
- describe('get_meta_schema', () => {
124
- it('returns meta-schema constraints', async () => {
125
- const result = await harness.client.callTool({ name: 'get_meta_schema', arguments: {} });
126
- assertSuccessResult(result as any);
127
- });
128
-
129
- it('returns error on failure', async () => {
130
- (harness.mockSdk.schemas as any).getMetaSchema.mockRejectedValueOnce(new Error('Fail'));
131
- const result = await harness.client.callTool({ name: 'get_meta_schema', arguments: {} });
132
- assertErrorResult(result as any);
133
- });
134
- });
135
-
136
- describe('preview_schema', () => {
137
- it('returns valid preview', async () => {
138
- const result = await harness.client.callTool({
139
- name: 'preview_schema',
140
- arguments: {
141
- contractType: 'ACH-CUSTOM-v1',
142
- displayName: 'Custom',
143
- mandateSchema: { type: 'object' },
144
- receiptSchema: { type: 'object' },
145
- },
146
- });
147
- assertSuccessResult(result as any);
148
- });
149
-
150
- it('returns error on failure', async () => {
151
- (harness.mockSdk.schemas as any).preview.mockRejectedValueOnce(new Error('Bad schema'));
152
- const result = await harness.client.callTool({
153
- name: 'preview_schema',
154
- arguments: {
155
- contractType: 'ACH-PROC-v1',
156
- displayName: 'Bad',
157
- mandateSchema: {},
158
- receiptSchema: {},
159
- },
160
- });
161
- assertErrorResult(result as any);
162
- });
163
- });
164
-
165
- describe('register_schema', () => {
166
- it('registers and returns version', async () => {
167
- const result = await harness.client.callTool({
168
- name: 'register_schema',
169
- arguments: {
170
- contractType: 'ACH-CUSTOM-v1',
171
- displayName: 'Custom',
172
- mandateSchema: { type: 'object' },
173
- receiptSchema: { type: 'object' },
174
- },
175
- });
176
- assertSuccessResult(result as any);
177
- });
178
-
179
- it('returns error on failure', async () => {
180
- (harness.mockSdk.schemas as any).register.mockRejectedValueOnce(new Error('Conflict'));
181
- const result = await harness.client.callTool({
182
- name: 'register_schema',
183
- arguments: {
184
- contractType: 'ACH-CUSTOM-v1',
185
- displayName: 'Custom',
186
- mandateSchema: {},
187
- receiptSchema: {},
188
- },
189
- });
190
- assertErrorResult(result as any);
191
- });
192
- });
193
-
194
- describe('get_schema_versions', () => {
195
- it('returns version list', async () => {
196
- const result = await harness.client.callTool({ name: 'get_schema_versions', arguments: { contractType: 'ACH-CUSTOM-v1' } });
197
- assertSuccessResult(result as any);
198
- });
199
-
200
- it('returns error on failure', async () => {
201
- (harness.mockSdk.schemas as any).getVersions.mockRejectedValueOnce(new Error('Fail'));
202
- const result = await harness.client.callTool({ name: 'get_schema_versions', arguments: { contractType: 'ACH-PROC-v1' } });
203
- assertErrorResult(result as any);
204
- });
205
- });
206
-
207
- describe('diff_schema_versions', () => {
208
- it('returns diff between versions', async () => {
209
- const result = await harness.client.callTool({
210
- name: 'diff_schema_versions',
211
- arguments: { contractType: 'ACH-CUSTOM-v1', from: 1, to: 2 },
212
- });
213
- assertSuccessResult(result as any);
214
- });
215
-
216
- it('returns error on failure', async () => {
217
- (harness.mockSdk.schemas as any).diff.mockRejectedValueOnce(new Error('Not found'));
218
- const result = await harness.client.callTool({
219
- name: 'diff_schema_versions',
220
- arguments: { contractType: 'ACH-PROC-v1', from: 1, to: 2 },
221
- });
222
- assertErrorResult(result as any);
223
- });
224
- });
225
-
226
- describe('get_schema_template', () => {
227
- it('returns template from existing type', async () => {
228
- const result = await harness.client.callTool({ name: 'get_schema_template', arguments: { contractType: 'ACH-PROC-v1' } });
229
- assertSuccessResult(result as any);
230
- });
231
-
232
- it('returns error on failure', async () => {
233
- (harness.mockSdk.schemas as any).getTemplate.mockRejectedValueOnce(new Error('Not found'));
234
- const result = await harness.client.callTool({ name: 'get_schema_template', arguments: { contractType: 'ACH-PROC-v1' } });
235
- assertErrorResult(result as any);
236
- });
237
- });
238
-
239
- describe('get_blank_schema_template', () => {
240
- it('returns blank template', async () => {
241
- const result = await harness.client.callTool({ name: 'get_blank_schema_template', arguments: {} });
242
- assertSuccessResult(result as any);
243
- });
244
-
245
- it('returns error on failure', async () => {
246
- (harness.mockSdk.schemas as any).getBlankTemplate.mockRejectedValueOnce(new Error('Fail'));
247
- const result = await harness.client.callTool({ name: 'get_blank_schema_template', arguments: {} });
248
- assertErrorResult(result as any);
249
- });
250
- });
251
-
252
- describe('check_schema_compatibility', () => {
253
- it('returns compatibility result', async () => {
254
- const result = await harness.client.callTool({
255
- name: 'check_schema_compatibility',
256
- arguments: {
257
- contractType: 'ACH-CUSTOM-v1',
258
- mandateSchema: { type: 'object' },
259
- receiptSchema: { type: 'object' },
260
- },
261
- });
262
- assertSuccessResult(result as any);
263
- });
264
-
265
- it('returns error on failure', async () => {
266
- (harness.mockSdk.schemas as any).checkCompatibility.mockRejectedValueOnce(new Error('Fail'));
267
- const result = await harness.client.callTool({
268
- name: 'check_schema_compatibility',
269
- arguments: {
270
- contractType: 'ACH-PROC-v1',
271
- mandateSchema: {},
272
- receiptSchema: {},
273
- },
274
- });
275
- assertErrorResult(result as any);
276
- });
277
- });
278
-
279
- describe('get_schema_version', () => {
280
- it('returns specific version', async () => {
281
- const result = await harness.client.callTool({
282
- name: 'get_schema_version',
283
- arguments: { contractType: 'ACH-CUSTOM-v1', version: 1 },
284
- });
285
- assertSuccessResult(result as any);
286
- });
287
-
288
- it('returns error on failure', async () => {
289
- (harness.mockSdk.schemas as any).getVersion.mockRejectedValueOnce(new Error('Not found'));
290
- const result = await harness.client.callTool({
291
- name: 'get_schema_version',
292
- arguments: { contractType: 'ACH-PROC-v1', version: 99 },
293
- });
294
- assertErrorResult(result as any);
295
- });
296
- });
297
-
298
- describe('validate_receipt_schema', () => {
299
- it('returns valid result', async () => {
300
- const result = await harness.client.callTool({
301
- name: 'validate_receipt_schema',
302
- arguments: { contractType: 'ACH-PROC-v1', evidence: { delivered: true } },
303
- });
304
- assertSuccessResult(result as any);
305
- });
306
-
307
- it('returns error on failure', async () => {
308
- (harness.mockSdk.schemas as any).validateReceipt.mockRejectedValueOnce(new Error('Fail'));
309
- const result = await harness.client.callTool({
310
- name: 'validate_receipt_schema',
311
- arguments: { contractType: 'ACH-PROC-v1', evidence: {} },
312
- });
313
- assertErrorResult(result as any);
314
- });
315
- });
316
-
317
- describe('get_schema_rules', () => {
318
- it('returns rules for contract type', async () => {
319
- const result = await harness.client.callTool({ name: 'get_schema_rules', arguments: { contractType: 'ACH-PROC-v1' } });
320
- assertSuccessResult(result as any);
321
- });
322
-
323
- it('returns error on failure', async () => {
324
- (harness.mockSdk.schemas as any).getRules.mockRejectedValueOnce(new Error('Fail'));
325
- const result = await harness.client.callTool({ name: 'get_schema_rules', arguments: { contractType: 'ACH-PROC-v1' } });
326
- assertErrorResult(result as any);
327
- });
328
- });
329
-
330
- describe('delete_schema', () => {
331
- it('deletes a custom schema', async () => {
332
- const result = await harness.client.callTool({ name: 'delete_schema', arguments: { contractType: 'ACH-CUSTOM-v1' } });
333
- assertSuccessResult(result as any);
334
- });
335
-
336
- it('returns error on failure', async () => {
337
- (harness.mockSdk.schemas as any).delete.mockRejectedValueOnce(new Error('Cannot delete builtin'));
338
- const result = await harness.client.callTool({ name: 'delete_schema', arguments: { contractType: 'ACH-PROC-v1' } });
339
- assertErrorResult(result as any);
340
- });
341
- });
342
-
343
- describe('export_schema', () => {
344
- it('exports schema bundle', async () => {
345
- const result = await harness.client.callTool({ name: 'export_schema', arguments: { contractType: 'ACH-CUSTOM-v1' } });
346
- assertSuccessResult(result as any);
347
- });
348
-
349
- it('returns error on failure', async () => {
350
- (harness.mockSdk.schemas as any).exportSchema.mockRejectedValueOnce(new Error('Not found'));
351
- const result = await harness.client.callTool({ name: 'export_schema', arguments: { contractType: 'ACH-PROC-v1' } });
352
- assertErrorResult(result as any);
353
- });
354
- });
355
-
356
- describe('import_schema', () => {
357
- it('imports schema bundle', async () => {
358
- const result = await harness.client.callTool({
359
- name: 'import_schema',
360
- arguments: { bundle: { contractType: 'ACH-CUSTOM-v1' } },
361
- });
362
- assertSuccessResult(result as any);
363
- });
364
-
365
- it('returns error on failure', async () => {
366
- (harness.mockSdk.schemas as any).importSchema.mockRejectedValueOnce(new Error('Invalid bundle'));
367
- const result = await harness.client.callTool({
368
- name: 'import_schema',
369
- arguments: { bundle: {} },
370
- });
371
- assertErrorResult(result as any);
372
- });
373
- });
374
- });
@@ -1,56 +0,0 @@
1
- import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest';
2
- import { registerVerificationKeysTools } from '../../src/tools/verification-keys.js';
3
- import { createTestHarness, type TestHarness } from '../harness.js';
4
- import { assertErrorResult, assertSuccessResult } from '../conformance.js';
5
-
6
- describe('verification-keys tools', () => {
7
- let harness: TestHarness;
8
-
9
- beforeAll(async () => {
10
- harness = await createTestHarness({
11
- registerFns: [registerVerificationKeysTools],
12
- mockOverrides: {
13
- verificationKeys: {
14
- list: vi.fn().mockResolvedValue({
15
- data: [
16
- { keyId: 'key-1', algorithm: 'Ed25519', publicKey: 'base64key1', status: 'active', activatedAt: '2026-01-01', retiredAt: null },
17
- { keyId: 'key-2', algorithm: 'Ed25519', publicKey: 'base64key2', status: 'retired', activatedAt: '2025-01-01', retiredAt: '2026-01-01' },
18
- ],
19
- canonicalization: 'RFC8785',
20
- hashAlgorithm: 'SHA-256',
21
- signatureAlgorithm: 'Ed25519',
22
- }),
23
- },
24
- },
25
- });
26
- });
27
-
28
- afterAll(async () => {
29
- await harness.cleanup();
30
- });
31
-
32
- it('registers exactly 1 tool: list_verification_keys', async () => {
33
- const { tools } = await harness.client.listTools();
34
- expect(tools.map((t: any) => t.name)).toEqual(['list_verification_keys']);
35
- });
36
-
37
- describe('list_verification_keys', () => {
38
- it('returns verification keys on success', async () => {
39
- const result = await harness.client.callTool({
40
- name: 'list_verification_keys',
41
- arguments: {},
42
- });
43
- assertSuccessResult(result as any);
44
- expect((harness.mockSdk.verificationKeys as any).list).toHaveBeenCalledOnce();
45
- });
46
-
47
- it('returns error on failure', async () => {
48
- (harness.mockSdk.verificationKeys as any).list.mockRejectedValueOnce(new Error('Connection refused'));
49
- const result = await harness.client.callTool({
50
- name: 'list_verification_keys',
51
- arguments: {},
52
- });
53
- assertErrorResult(result as any);
54
- });
55
- });
56
- });
@@ -1,64 +0,0 @@
1
- import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest';
2
- import { registerVerificationTools } from '../../src/tools/verification.js';
3
- import { createTestHarness, type TestHarness } from '../harness.js';
4
- import { assertErrorResult, assertSuccessResult } from '../conformance.js';
5
-
6
- describe('verification tools', () => {
7
- let harness: TestHarness;
8
-
9
- beforeAll(async () => {
10
- harness = await createTestHarness({
11
- registerFns: [registerVerificationTools],
12
- mockOverrides: {
13
- verification: {
14
- verify: vi.fn().mockResolvedValue({
15
- mandateId: 'm-1',
16
- receipts: [{ receiptId: 'r-1', phase1Result: { passed: true } }],
17
- overallStatus: 'PASS',
18
- }),
19
- getStatus: vi.fn().mockResolvedValue({
20
- mandateId: 'm-1',
21
- phase1Status: 'COMPLETE',
22
- phase2Status: 'PENDING',
23
- lastVerifiedAt: '2026-04-13T00:00:00Z',
24
- pendingRules: ['async-rule-1'],
25
- }),
26
- },
27
- },
28
- });
29
- });
30
-
31
- afterAll(async () => { await harness.cleanup(); });
32
-
33
- it('registers exactly 2 tools', async () => {
34
- const { tools } = await harness.client.listTools();
35
- expect(tools.map((t: any) => t.name).sort()).toEqual(['get_verification_status', 'verify_mandate']);
36
- });
37
-
38
- describe('verify_mandate', () => {
39
- it('returns verification result on success', async () => {
40
- const result = await harness.client.callTool({ name: 'verify_mandate', arguments: { mandateId: 'm-1' } });
41
- assertSuccessResult(result as any);
42
- expect((harness.mockSdk.verification as any).verify).toHaveBeenCalledWith('m-1');
43
- });
44
-
45
- it('returns error on failure', async () => {
46
- (harness.mockSdk.verification as any).verify.mockRejectedValueOnce(new Error('Mandate not found'));
47
- const result = await harness.client.callTool({ name: 'verify_mandate', arguments: { mandateId: 'bad-id' } });
48
- assertErrorResult(result as any);
49
- });
50
- });
51
-
52
- describe('get_verification_status', () => {
53
- it('returns status on success', async () => {
54
- const result = await harness.client.callTool({ name: 'get_verification_status', arguments: { mandateId: 'm-1' } });
55
- assertSuccessResult(result as any);
56
- });
57
-
58
- it('returns error on failure', async () => {
59
- (harness.mockSdk.verification as any).getStatus.mockRejectedValueOnce(new Error('Not found'));
60
- const result = await harness.client.callTool({ name: 'get_verification_status', arguments: { mandateId: 'bad' } });
61
- assertErrorResult(result as any);
62
- });
63
- });
64
- });