@agledger/mcp-server 1.4.3 → 1.5.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 (119) hide show
  1. package/dist/index.d.ts.map +1 -1
  2. package/dist/index.js +0 -2
  3. package/dist/index.js.map +1 -1
  4. package/dist/server.d.ts +2 -2
  5. package/dist/server.d.ts.map +1 -1
  6. package/dist/server.js +1 -3
  7. package/dist/server.js.map +1 -1
  8. package/dist/tool-scopes.d.ts.map +1 -1
  9. package/dist/tool-scopes.js +0 -3
  10. package/dist/tool-scopes.js.map +1 -1
  11. package/dist/tools/a2a.d.ts.map +1 -1
  12. package/dist/tools/a2a.js +20 -220
  13. package/dist/tools/a2a.js.map +1 -1
  14. package/dist/tools/agent-mandates.d.ts.map +1 -1
  15. package/dist/tools/agent-mandates.js +10 -74
  16. package/dist/tools/agent-mandates.js.map +1 -1
  17. package/dist/tools/agents-refs.d.ts.map +1 -1
  18. package/dist/tools/agents-refs.js +9 -61
  19. package/dist/tools/agents-refs.js.map +1 -1
  20. package/dist/tools/capabilities.d.ts.map +1 -1
  21. package/dist/tools/capabilities.js +2 -14
  22. package/dist/tools/capabilities.js.map +1 -1
  23. package/dist/tools/code-mode.d.ts.map +1 -1
  24. package/dist/tools/code-mode.js +4 -35
  25. package/dist/tools/code-mode.js.map +1 -1
  26. package/dist/tools/compliance.d.ts.map +1 -1
  27. package/dist/tools/compliance.js +3 -37
  28. package/dist/tools/compliance.js.map +1 -1
  29. package/dist/tools/dashboard.d.ts.map +1 -1
  30. package/dist/tools/dashboard.js +3 -37
  31. package/dist/tools/dashboard.js.map +1 -1
  32. package/dist/tools/disputes.d.ts.map +1 -1
  33. package/dist/tools/disputes.js +4 -41
  34. package/dist/tools/disputes.js.map +1 -1
  35. package/dist/tools/enterprises.d.ts.map +1 -1
  36. package/dist/tools/enterprises.js +6 -62
  37. package/dist/tools/enterprises.js.map +1 -1
  38. package/dist/tools/events.d.ts.map +1 -1
  39. package/dist/tools/events.js +1 -19
  40. package/dist/tools/events.js.map +1 -1
  41. package/dist/tools/federation-admin.d.ts.map +1 -1
  42. package/dist/tools/federation-admin.js +24 -256
  43. package/dist/tools/federation-admin.js.map +1 -1
  44. package/dist/tools/federation.d.ts.map +1 -1
  45. package/dist/tools/federation.js +20 -197
  46. package/dist/tools/federation.js.map +1 -1
  47. package/dist/tools/health.d.ts.map +1 -1
  48. package/dist/tools/health.js +1 -13
  49. package/dist/tools/health.js.map +1 -1
  50. package/dist/tools/mandates.d.ts.map +1 -1
  51. package/dist/tools/mandates.js +10 -93
  52. package/dist/tools/mandates.js.map +1 -1
  53. package/dist/tools/openclaw.d.ts.map +1 -1
  54. package/dist/tools/openclaw.js +5 -32
  55. package/dist/tools/openclaw.js.map +1 -1
  56. package/dist/tools/receipts.d.ts.map +1 -1
  57. package/dist/tools/receipts.js +4 -94
  58. package/dist/tools/receipts.js.map +1 -1
  59. package/dist/tools/reputation.d.ts.map +1 -1
  60. package/dist/tools/reputation.js +3 -33
  61. package/dist/tools/reputation.js.map +1 -1
  62. package/dist/tools/schemas.d.ts.map +1 -1
  63. package/dist/tools/schemas.js +16 -186
  64. package/dist/tools/schemas.js.map +1 -1
  65. package/dist/tools/verification-keys.d.ts.map +1 -1
  66. package/dist/tools/verification-keys.js +1 -22
  67. package/dist/tools/verification-keys.js.map +1 -1
  68. package/dist/tools/verification.d.ts.map +1 -1
  69. package/dist/tools/verification.js +2 -27
  70. package/dist/tools/verification.js.map +1 -1
  71. package/package.json +1 -1
  72. package/src/index.ts +1 -3
  73. package/src/server.ts +3 -5
  74. package/src/tool-scopes.ts +0 -4
  75. package/src/tools/a2a.ts +20 -233
  76. package/src/tools/agent-mandates.ts +10 -76
  77. package/src/tools/agents-refs.ts +9 -65
  78. package/src/tools/capabilities.ts +2 -15
  79. package/src/tools/compliance.ts +3 -37
  80. package/src/tools/dashboard.ts +3 -37
  81. package/src/tools/disputes.ts +4 -42
  82. package/src/tools/enterprises.ts +6 -62
  83. package/src/tools/events.ts +1 -20
  84. package/src/tools/federation-admin.ts +24 -281
  85. package/src/tools/federation.ts +20 -217
  86. package/src/tools/health.ts +1 -14
  87. package/src/tools/mandates.ts +10 -95
  88. package/src/tools/openclaw.ts +5 -51
  89. package/src/tools/receipts.ts +4 -95
  90. package/src/tools/reputation.ts +3 -34
  91. package/src/tools/schemas.ts +16 -194
  92. package/src/tools/verification-keys.ts +1 -24
  93. package/src/tools/verification.ts +2 -29
  94. package/tests/conformance.test.ts +4 -26
  95. package/tests/conformance.ts +3 -13
  96. package/tests/profiles.test.ts +2 -17
  97. package/tests/tools/a2a.test.ts +0 -28
  98. package/tests/tools/agent-mandates.test.ts +0 -10
  99. package/tests/tools/agents-refs.test.ts +0 -9
  100. package/tests/tools/capabilities.test.ts +0 -6
  101. package/tests/tools/compliance.test.ts +0 -8
  102. package/tests/tools/dashboard.test.ts +0 -9
  103. package/tests/tools/disputes.test.ts +0 -8
  104. package/tests/tools/enterprises.test.ts +0 -10
  105. package/tests/tools/events.test.ts +0 -5
  106. package/tests/tools/federation-admin.test.ts +0 -41
  107. package/tests/tools/federation.test.ts +0 -34
  108. package/tests/tools/health.test.ts +1 -12
  109. package/tests/tools/mandates.test.ts +0 -12
  110. package/tests/tools/openclaw.test.ts +0 -12
  111. package/tests/tools/receipts.test.ts +1 -14
  112. package/tests/tools/reputation.test.ts +0 -9
  113. package/tests/tools/schemas.test.ts +0 -23
  114. package/tests/tools/verification-keys.test.ts +0 -6
  115. package/tests/tools/verification.test.ts +1 -11
  116. package/src/tools/code-mode.ts +0 -461
  117. package/tests/drift/code-mode-manifest.test.ts +0 -144
  118. package/tests/integration/output-schema-validation.test.ts +0 -167
  119. package/tests/tools/code-mode.test.ts +0 -168
@@ -5,122 +5,6 @@ import { apiErrorResult, toStructuredContent } from '../errors.js';
5
5
  import { toolMeta } from '../tool-scopes.js';
6
6
  import { FederationSignalEnum, FederationOutcomeEnum, RevocationReasonEnum } from '../enums.js';
7
7
 
8
- const GatewayOutputSchema = z.object({
9
- gatewayId: z.string().describe('Federation gateway ID'),
10
- organizationId: z.string().describe('Organization ID'),
11
- status: z.string().describe('Gateway status'),
12
- }).passthrough().describe('Federation gateway registration result');
13
-
14
- const HeartbeatOutputSchema = z.object({
15
- gatewayId: z.string().describe('Federation gateway ID'),
16
- token: z.string().optional().describe('Refreshed bearer token'),
17
- expiresAt: z.string().optional().describe('ISO 8601 token expiry'),
18
- }).passthrough().describe('Heartbeat response with refreshed token');
19
-
20
- const AgentOutputSchema = z.object({
21
- agentId: z.string().describe('Federated agent ID'),
22
- gatewayId: z.string().optional().describe('Owning gateway ID'),
23
- contractTypes: z.array(z.string()).describe('Supported contract types'),
24
- displayName: z.string().optional().describe('Agent display name'),
25
- }).passthrough().describe('Federated agent registration result');
26
-
27
- const AgentListOutputSchema = z.object({
28
- agents: z.array(AgentOutputSchema).describe('List of federated agents'),
29
- cursor: z.string().optional().describe('Pagination cursor for next page'),
30
- }).passthrough().describe('Paginated list of federated agents');
31
-
32
- const TransitionOutputSchema = z.object({
33
- mandateId: z.string().describe('Mandate ID'),
34
- state: z.string().describe('New mandate state'),
35
- seq: z.number().describe('Sequence number'),
36
- }).passthrough().describe('State transition result');
37
-
38
- const SignalOutputSchema = z.object({
39
- mandateId: z.string().describe('Mandate ID'),
40
- signal: z.string().describe('Settlement signal'),
41
- signalSeq: z.number().describe('Signal sequence number'),
42
- }).passthrough().describe('Settlement signal relay result');
43
-
44
- const KeyRotationOutputSchema = z.object({
45
- gatewayId: z.string().describe('Gateway ID'),
46
- rotatedAt: z.string().optional().describe('ISO 8601 rotation timestamp'),
47
- }).passthrough().describe('Key rotation result');
48
-
49
- const RevocationOutputSchema = z.object({
50
- gatewayId: z.string().describe('Revoked gateway ID'),
51
- reason: z.string().describe('Revocation reason'),
52
- revokedAt: z.string().optional().describe('ISO 8601 revocation timestamp'),
53
- }).passthrough().describe('Gateway revocation result');
54
-
55
- const CatchUpOutputSchema = z.object({
56
- data: z.array(TransitionOutputSchema).describe('Missed audit entries'),
57
- nextPosition: z.number().optional().describe('Position for next catch-up call'),
58
- }).passthrough().describe('Partition recovery result with missed transitions');
59
-
60
- const StreamOutputSchema = z.object({
61
- events: z.array(z.object({
62
- type: z.string().describe('Event type'),
63
- timestamp: z.string().describe('ISO 8601 event timestamp'),
64
- }).passthrough()).optional().describe('Federation events since the given timestamp'),
65
- }).passthrough().describe('Federation event stream result');
66
-
67
- const SchemaPublishOutputSchema = z.object({
68
- contractType: z.string().describe('Contract type identifier'),
69
- status: z.string().optional().describe('Publication status (pending, confirmed)'),
70
- confirmationToken: z.string().optional().describe('Token required to confirm the publication'),
71
- }).passthrough().describe('Schema publication initiation result');
72
-
73
- const SchemaConfirmOutputSchema = z.object({
74
- contractType: z.string().describe('Contract type identifier'),
75
- confirmed: z.boolean().optional().describe('Whether the publication was confirmed'),
76
- }).passthrough().describe('Schema publication confirmation result');
77
-
78
- const ContractTypeListOutputSchema = z.object({
79
- contractTypes: z.array(z.object({
80
- contractType: z.string().describe('Contract type identifier'),
81
- version: z.string().optional().describe('Schema version'),
82
- status: z.string().optional().describe('Type status'),
83
- }).passthrough()).optional().describe('Available contract types'),
84
- }).passthrough().describe('List of federated contract types');
85
-
86
- const ContractTypeOutputSchema = z.object({
87
- contractType: z.string().describe('Contract type identifier'),
88
- version: z.string().optional().describe('Schema version'),
89
- status: z.string().optional().describe('Type status'),
90
- schema: z.record(z.string(), z.unknown()).optional().describe('JSON Schema definition'),
91
- }).passthrough().describe('Contract type details');
92
-
93
- const MandateCriteriaOutputSchema = z.object({
94
- mandateId: z.string().describe('Federation mandate ID'),
95
- contractType: z.string().optional().describe('Contract type identifier'),
96
- criteria: z.record(z.string(), z.unknown()).optional().describe('Acceptance criteria'),
97
- }).passthrough().describe('Cross-boundary mandate criteria');
98
-
99
- const MandateCriteriaSubmitOutputSchema = z.object({
100
- mandateId: z.string().describe('Federation mandate ID'),
101
- status: z.string().optional().describe('Submission status'),
102
- }).passthrough().describe('Criteria submission result');
103
-
104
- const ReputationContributeOutputSchema = z.object({
105
- agentId: z.string().describe('Federated agent ID'),
106
- recorded: z.boolean().optional().describe('Whether the contribution was recorded'),
107
- }).passthrough().describe('Reputation contribution result');
108
-
109
- const AgentReputationOutputSchema = z.object({
110
- agentId: z.string().describe('Federated agent ID'),
111
- score: z.number().optional().describe('Aggregate reputation score'),
112
- totalMandates: z.number().optional().describe('Total mandates across all gateways'),
113
- }).passthrough().describe('Federated agent reputation');
114
-
115
- const BroadcastRevocationsOutputSchema = z.object({
116
- gatewayId: z.string().describe('Revoked gateway ID'),
117
- peersNotified: z.number().optional().describe('Number of peer gateways notified'),
118
- }).passthrough().describe('Revocation broadcast result');
119
-
120
- const SyncAgentDirectoryOutputSchema = z.object({
121
- synced: z.number().optional().describe('Number of agents synced'),
122
- }).passthrough().describe('Agent directory sync result');
123
-
124
8
  export function registerFederationTools(mcp: McpServer, client: AgledgerClient): void {
125
9
 
126
10
  mcp.registerTool(
@@ -141,7 +25,6 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
141
25
  displayName: z.string().optional().describe('Human-readable gateway name'),
142
26
  capabilities: z.array(z.string()).optional().describe('Gateway capabilities (e.g. contract types supported)'),
143
27
  },
144
- outputSchema: GatewayOutputSchema,
145
28
  annotations: {
146
29
  readOnlyHint: false,
147
30
  destructiveHint: false,
@@ -153,10 +36,7 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
153
36
  async (args) => {
154
37
  try {
155
38
  const result = await client.federation.register(args);
156
- return {
157
- content: [{ type: 'text', text: `Gateway ${result.gatewayId} registered. Token expires at ${result.bearerTokenExpiresAt}. Use federation_heartbeat to refresh your token before it expires.` }],
158
- structuredContent: toStructuredContent(result),
159
- };
39
+ return { content: [], structuredContent: toStructuredContent(result) };
160
40
  } catch (err) {
161
41
  return apiErrorResult(err);
162
42
  }
@@ -174,7 +54,6 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
174
54
  mandateCount: z.number().describe('Current number of active mandates'),
175
55
  timestamp: z.string().describe('ISO 8601 timestamp of this heartbeat'),
176
56
  },
177
- outputSchema: HeartbeatOutputSchema,
178
57
  annotations: {
179
58
  readOnlyHint: false,
180
59
  destructiveHint: false,
@@ -186,10 +65,7 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
186
65
  async (args) => {
187
66
  try {
188
67
  const result = await client.federation.heartbeat(args);
189
- return {
190
- content: [{ type: 'text', text: `Heartbeat accepted for gateway ${args.gatewayId}. Token expires at ${result.bearerTokenExpiresAt}. ${result.revocations.length > 0 ? `${result.revocations.length} revocation(s) received.` : ''}` }],
191
- structuredContent: toStructuredContent(result),
192
- };
68
+ return { content: [], structuredContent: toStructuredContent(result) };
193
69
  } catch (err) {
194
70
  return apiErrorResult(err);
195
71
  }
@@ -206,7 +82,6 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
206
82
  contractTypes: z.array(z.string()).describe('Contract types this agent supports'),
207
83
  displayName: z.string().optional().describe('Human-readable agent name'),
208
84
  },
209
- outputSchema: AgentOutputSchema,
210
85
  annotations: {
211
86
  readOnlyHint: false,
212
87
  destructiveHint: false,
@@ -218,10 +93,7 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
218
93
  async (args) => {
219
94
  try {
220
95
  const result = await client.federation.registerAgent(args);
221
- return {
222
- content: [{ type: 'text', text: `Agent ${args.agentId} registered: ${result.registered}.` }],
223
- structuredContent: toStructuredContent(result),
224
- };
96
+ return { content: [], structuredContent: toStructuredContent(result) };
225
97
  } catch (err) {
226
98
  return apiErrorResult(err);
227
99
  }
@@ -238,7 +110,6 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
238
110
  limit: z.number().optional().describe('Maximum number of agents to return'),
239
111
  cursor: z.string().optional().describe('Pagination cursor from previous response'),
240
112
  },
241
- outputSchema: AgentListOutputSchema,
242
113
  annotations: {
243
114
  readOnlyHint: true,
244
115
  destructiveHint: false,
@@ -250,10 +121,7 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
250
121
  async (args) => {
251
122
  try {
252
123
  const result = await client.federation.listAgents(args);
253
- return {
254
- content: [{ type: 'text', text: `Found ${result.data.length} federated agent(s).${result.hasMore ? ' More results available — pass cursor to paginate.' : ''}` }],
255
- structuredContent: toStructuredContent(result),
256
- };
124
+ return { content: [], structuredContent: toStructuredContent(result) };
257
125
  } catch (err) {
258
126
  return apiErrorResult(err);
259
127
  }
@@ -279,7 +147,6 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
279
147
  signature: z.string().describe('Ed25519 signature over the transition payload'),
280
148
  performerGatewayId: z.string().optional().describe('Performer gateway ID (if different from submitter)'),
281
149
  },
282
- outputSchema: TransitionOutputSchema,
283
150
  annotations: {
284
151
  readOnlyHint: false,
285
152
  destructiveHint: false,
@@ -291,10 +158,7 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
291
158
  async (args) => {
292
159
  try {
293
160
  const result = await client.federation.submitStateTransition(args);
294
- return {
295
- content: [{ type: 'text', text: `Transition accepted. Hub state: ${result.hubState}. Sub-status: ${result.subStatus}. Hub timestamp: ${result.hubTimestamp}.` }],
296
- structuredContent: toStructuredContent(result),
297
- };
161
+ return { content: [], structuredContent: toStructuredContent(result) };
298
162
  } catch (err) {
299
163
  return apiErrorResult(err);
300
164
  }
@@ -318,7 +182,6 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
318
182
  performerSignature: z.string().describe('Ed25519 signature from the performer gateway'),
319
183
  outcome: FederationOutcomeEnum.optional().describe('Verdict outcome if signal is SETTLE'),
320
184
  },
321
- outputSchema: SignalOutputSchema,
322
185
  annotations: {
323
186
  readOnlyHint: false,
324
187
  destructiveHint: false,
@@ -330,10 +193,7 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
330
193
  async (args) => {
331
194
  try {
332
195
  const result = await client.federation.relaySignal(args);
333
- return {
334
- content: [{ type: 'text', text: `Signal relayed: ${result.relayed}. Target gateway: ${result.targetGatewayId}. Hub timestamp: ${result.hubTimestamp}.` }],
335
- structuredContent: toStructuredContent(result),
336
- };
196
+ return { content: [], structuredContent: toStructuredContent(result) };
337
197
  } catch (err) {
338
198
  return apiErrorResult(err);
339
199
  }
@@ -354,7 +214,6 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
354
214
  timestamp: z.string().describe('ISO 8601 timestamp of this rotation'),
355
215
  nonce: z.string().describe('Unique nonce to prevent replay'),
356
216
  },
357
- outputSchema: KeyRotationOutputSchema,
358
217
  annotations: {
359
218
  readOnlyHint: false,
360
219
  destructiveHint: true,
@@ -367,10 +226,7 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
367
226
  try {
368
227
  const { gatewayId, ...rotateParams } = args;
369
228
  const result = await client.federation.rotateKey(gatewayId, rotateParams);
370
- return {
371
- content: [{ type: 'text', text: `Keys rotated for gateway ${gatewayId}: ${result.rotated ? 'success' : 'failed'}.` }],
372
- structuredContent: toStructuredContent(result),
373
- };
229
+ return { content: [], structuredContent: toStructuredContent(result) };
374
230
  } catch (err) {
375
231
  return apiErrorResult(err);
376
232
  }
@@ -387,7 +243,6 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
387
243
  revocationSecret: z.string().describe('Revocation secret set during registration'),
388
244
  reason: RevocationReasonEnum.describe('Reason for revocation'),
389
245
  },
390
- outputSchema: RevocationOutputSchema,
391
246
  annotations: {
392
247
  readOnlyHint: false,
393
248
  destructiveHint: true,
@@ -400,10 +255,7 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
400
255
  try {
401
256
  const { gatewayId, ...revokeParams } = args;
402
257
  const result = await client.federation.revoke(gatewayId, revokeParams);
403
- return {
404
- content: [{ type: 'text', text: `Gateway ${gatewayId} revoked: ${result.revoked}. Revoked at: ${result.revokedAt}. This action is permanent.` }],
405
- structuredContent: toStructuredContent(result),
406
- };
258
+ return { content: [], structuredContent: toStructuredContent(result) };
407
259
  } catch (err) {
408
260
  return apiErrorResult(err);
409
261
  }
@@ -419,7 +271,6 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
419
271
  sincePosition: z.number().describe('Position to catch up from (exclusive)'),
420
272
  limit: z.number().optional().describe('Maximum number of transitions to return'),
421
273
  },
422
- outputSchema: CatchUpOutputSchema,
423
274
  annotations: {
424
275
  readOnlyHint: true,
425
276
  destructiveHint: false,
@@ -431,10 +282,7 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
431
282
  async (args) => {
432
283
  try {
433
284
  const result = await client.federation.catchUp(args);
434
- return {
435
- content: [{ type: 'text', text: `Caught up ${result.data.length} entry(ies) since position ${args.sincePosition}.${result.hasMore ? ' More entries available.' : ' Fully caught up.'}` }],
436
- structuredContent: toStructuredContent(result),
437
- };
285
+ return { content: [], structuredContent: toStructuredContent(result) };
438
286
  } catch (err) {
439
287
  return apiErrorResult(err);
440
288
  }
@@ -449,7 +297,6 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
449
297
  inputSchema: {
450
298
  since: z.string().optional().describe('ISO 8601 timestamp to stream events from (exclusive)'),
451
299
  },
452
- outputSchema: StreamOutputSchema,
453
300
  annotations: {
454
301
  readOnlyHint: true,
455
302
  destructiveHint: false,
@@ -461,11 +308,7 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
461
308
  async (args) => {
462
309
  try {
463
310
  const result = await client.federation.stream({ since: args.since });
464
- const events = Array.isArray(result['events']) ? result['events'] as unknown[] : [];
465
- return {
466
- content: [{ type: 'text', text: `Streamed ${events.length} federation event(s).${args.since ? ` Since: ${args.since}.` : ''}` }],
467
- structuredContent: toStructuredContent(result),
468
- };
311
+ return { content: [], structuredContent: toStructuredContent(result) };
469
312
  } catch (err) {
470
313
  return apiErrorResult(err);
471
314
  }
@@ -482,7 +325,6 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
482
325
  schema: z.record(z.string(), z.unknown()).describe('JSON Schema definition for the contract type'),
483
326
  visibility: z.enum(['hub-only', 'full']).optional().describe('Distribution scope: hub-only (hub retains schema) or full (replicated to all gateways)'),
484
327
  },
485
- outputSchema: SchemaPublishOutputSchema,
486
328
  annotations: {
487
329
  readOnlyHint: false,
488
330
  destructiveHint: false,
@@ -494,10 +336,7 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
494
336
  async (args) => {
495
337
  try {
496
338
  const result = await client.federation.publishSchema(args.contractType, { schema: args.schema, visibility: args.visibility });
497
- return {
498
- content: [{ type: 'text', text: `Schema publication initiated for ${args.contractType}. Status: ${result.status ?? 'pending'}. Use federation_confirm_schema_publish with the confirmation token to finalize.` }],
499
- structuredContent: toStructuredContent(result),
500
- };
339
+ return { content: [], structuredContent: toStructuredContent(result) };
501
340
  } catch (err) {
502
341
  return apiErrorResult(err);
503
342
  }
@@ -513,7 +352,6 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
513
352
  contractType: z.string().describe('Contract type identifier that was published'),
514
353
  confirmationToken: z.string().describe('Confirmation token from the publish response'),
515
354
  },
516
- outputSchema: SchemaConfirmOutputSchema,
517
355
  annotations: {
518
356
  readOnlyHint: false,
519
357
  destructiveHint: false,
@@ -525,10 +363,7 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
525
363
  async (args) => {
526
364
  try {
527
365
  const result = await client.federation.confirmSchemaPublish(args.contractType, { confirmationToken: args.confirmationToken });
528
- return {
529
- content: [{ type: 'text', text: `Schema publication confirmed for ${args.contractType}. The schema is now available to federated gateways.` }],
530
- structuredContent: toStructuredContent(result),
531
- };
366
+ return { content: [], structuredContent: toStructuredContent(result) };
532
367
  } catch (err) {
533
368
  return apiErrorResult(err);
534
369
  }
@@ -541,7 +376,6 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
541
376
  title: 'List Federation Contract Types',
542
377
  description: 'List contract types available through the federation hub. Use this to discover which contract types are supported across federated gateways before creating cross-boundary mandates.',
543
378
  inputSchema: {},
544
- outputSchema: ContractTypeListOutputSchema,
545
379
  annotations: {
546
380
  readOnlyHint: true,
547
381
  destructiveHint: false,
@@ -553,10 +387,7 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
553
387
  async () => {
554
388
  try {
555
389
  const result = await client.federation.listContractTypes();
556
- return {
557
- content: [{ type: 'text', text: `Found ${result.length} federated contract type(s). Use federation_get_contract_type for details on a specific type.` }],
558
- structuredContent: toStructuredContent({ contractTypes: result }),
559
- };
390
+ return { content: [], structuredContent: toStructuredContent({ contractTypes: result }) };
560
391
  } catch (err) {
561
392
  return apiErrorResult(err);
562
393
  }
@@ -571,7 +402,6 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
571
402
  inputSchema: {
572
403
  contractType: z.string().describe('Contract type identifier (e.g. ACH-PROC-v1)'),
573
404
  },
574
- outputSchema: ContractTypeOutputSchema,
575
405
  annotations: {
576
406
  readOnlyHint: true,
577
407
  destructiveHint: false,
@@ -583,10 +413,7 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
583
413
  async (args) => {
584
414
  try {
585
415
  const result = await client.federation.getContractType(args.contractType);
586
- return {
587
- content: [{ type: 'text', text: `Contract type ${args.contractType}: ${result.status ?? 'unknown status'}. Schema version: ${result.version ?? 'n/a'}.` }],
588
- structuredContent: toStructuredContent(result),
589
- };
416
+ return { content: [], structuredContent: toStructuredContent(result) };
590
417
  } catch (err) {
591
418
  return apiErrorResult(err);
592
419
  }
@@ -601,7 +428,6 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
601
428
  inputSchema: {
602
429
  mandateId: z.string().describe('Federation mandate ID'),
603
430
  },
604
- outputSchema: MandateCriteriaOutputSchema,
605
431
  annotations: {
606
432
  readOnlyHint: true,
607
433
  destructiveHint: false,
@@ -613,10 +439,7 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
613
439
  async (args) => {
614
440
  try {
615
441
  const result = await client.federation.getMandateCriteria(args.mandateId);
616
- return {
617
- content: [{ type: 'text', text: `Criteria retrieved for mandate ${result.mandateId}. Submitted by: ${result.submittedBy}.` }],
618
- structuredContent: toStructuredContent(result),
619
- };
442
+ return { content: [], structuredContent: toStructuredContent(result) };
620
443
  } catch (err) {
621
444
  return apiErrorResult(err);
622
445
  }
@@ -632,7 +455,6 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
632
455
  mandateId: z.string().describe('Federation mandate ID'),
633
456
  criteria: z.record(z.string(), z.unknown()).describe('Acceptance criteria matching the contract type schema'),
634
457
  },
635
- outputSchema: MandateCriteriaSubmitOutputSchema,
636
458
  annotations: {
637
459
  readOnlyHint: false,
638
460
  destructiveHint: false,
@@ -644,10 +466,7 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
644
466
  async (args) => {
645
467
  try {
646
468
  const result = await client.federation.submitMandateCriteria(args.mandateId, { criteria: args.criteria });
647
- return {
648
- content: [{ type: 'text', text: `Criteria submitted for mandate ${result.mandateId}. Submitted by: ${result.submittedBy} at ${result.submittedAt}.` }],
649
- structuredContent: toStructuredContent(result),
650
- };
469
+ return { content: [], structuredContent: toStructuredContent(result) };
651
470
  } catch (err) {
652
471
  return apiErrorResult(err);
653
472
  }
@@ -665,7 +484,6 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
665
484
  outcome: z.string().describe('Mandate outcome (e.g. PASS, FAIL)'),
666
485
  mandateId: z.string().optional().describe('Associated mandate ID for traceability'),
667
486
  },
668
- outputSchema: ReputationContributeOutputSchema,
669
487
  annotations: {
670
488
  readOnlyHint: false,
671
489
  destructiveHint: false,
@@ -677,10 +495,7 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
677
495
  async (args) => {
678
496
  try {
679
497
  const result = await client.federation.contributeReputation(args);
680
- return {
681
- content: [{ type: 'text', text: `Reputation contribution recorded for agent ${args.agentId}. Outcome: ${args.outcome}. Contract type: ${args.contractType}.` }],
682
- structuredContent: toStructuredContent(result),
683
- };
498
+ return { content: [], structuredContent: toStructuredContent(result) };
684
499
  } catch (err) {
685
500
  return apiErrorResult(err);
686
501
  }
@@ -695,7 +510,6 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
695
510
  inputSchema: {
696
511
  agentId: z.string().describe('Federated agent ID'),
697
512
  },
698
- outputSchema: AgentReputationOutputSchema,
699
513
  annotations: {
700
514
  readOnlyHint: true,
701
515
  destructiveHint: false,
@@ -707,10 +521,7 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
707
521
  async (args) => {
708
522
  try {
709
523
  const result = await client.federation.getAgentReputation(args.agentId);
710
- return {
711
- content: [{ type: 'text', text: `Reputation for agent ${args.agentId}: score ${result.overallScore}, contributions: ${result.contributions}.` }],
712
- structuredContent: toStructuredContent(result),
713
- };
524
+ return { content: [], structuredContent: toStructuredContent(result) };
714
525
  } catch (err) {
715
526
  return apiErrorResult(err);
716
527
  }
@@ -727,7 +538,6 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
727
538
  reason: z.string().describe('Reason for revocation'),
728
539
  revokedAt: z.string().describe('ISO 8601 timestamp when the revocation occurred'),
729
540
  },
730
- outputSchema: BroadcastRevocationsOutputSchema,
731
541
  annotations: {
732
542
  readOnlyHint: false,
733
543
  destructiveHint: false,
@@ -739,10 +549,7 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
739
549
  async (args) => {
740
550
  try {
741
551
  const result = await client.federation.broadcastRevocations(args);
742
- return {
743
- content: [{ type: 'text', text: `Revocation broadcast sent for gateway ${args.gatewayId}. Broadcast: ${result.broadcast}.` }],
744
- structuredContent: toStructuredContent(result),
745
- };
552
+ return { content: [], structuredContent: toStructuredContent(result) };
746
553
  } catch (err) {
747
554
  return apiErrorResult(err);
748
555
  }
@@ -760,7 +567,6 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
760
567
  contractTypes: z.array(z.string()).describe('Contract types this agent supports'),
761
568
  })).describe('List of agents to sync'),
762
569
  },
763
- outputSchema: SyncAgentDirectoryOutputSchema,
764
570
  annotations: {
765
571
  readOnlyHint: false,
766
572
  destructiveHint: false,
@@ -772,10 +578,7 @@ export function registerFederationTools(mcp: McpServer, client: AgledgerClient):
772
578
  async (args) => {
773
579
  try {
774
580
  const result = await client.federation.syncAgentDirectory(args);
775
- return {
776
- content: [{ type: 'text', text: `Agent directory synced: ${args.agents.length} agent(s) pushed. Synced: ${result.synced ?? 0}.` }],
777
- structuredContent: toStructuredContent(result),
778
- };
581
+ return { content: [], structuredContent: toStructuredContent(result) };
779
582
  } catch (err) {
780
583
  return apiErrorResult(err);
781
584
  }
@@ -1,17 +1,8 @@
1
- import { z } from 'zod';
2
1
  import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
2
  import type { AgledgerClient } from '@agledger/sdk';
4
3
  import { apiErrorResult, toStructuredContent } from '../errors.js';
5
4
  import { toolMeta } from '../tool-scopes.js';
6
5
 
7
- const HealthOutputSchema = z.object({
8
- status: z.string().describe('API health status (e.g. "ok", "degraded")'),
9
- version: z.string().optional().describe('API version string'),
10
- uptime: z.number().optional().describe('API uptime in seconds'),
11
- database: z.string().optional().describe('Database connection status'),
12
- timestamp: z.string().describe('ISO 8601 timestamp of the health check'),
13
- }).describe('AGLedger API health check response');
14
-
15
6
  export function registerHealthTools(mcp: McpServer, client: AgledgerClient): void {
16
7
  mcp.registerTool(
17
8
  'check_api_health',
@@ -19,7 +10,6 @@ export function registerHealthTools(mcp: McpServer, client: AgledgerClient): voi
19
10
  title: 'Check API Health',
20
11
  description: 'Check the health status of the AGLedger API, including database connectivity and uptime.',
21
12
  inputSchema: {},
22
- outputSchema: HealthOutputSchema,
23
13
  annotations: {
24
14
  readOnlyHint: true,
25
15
  destructiveHint: false,
@@ -31,10 +21,7 @@ export function registerHealthTools(mcp: McpServer, client: AgledgerClient): voi
31
21
  async () => {
32
22
  try {
33
23
  const health = await client.health.check();
34
- return {
35
- content: [{ type: 'text', text: `API health: status=${health.status}${health.version ? `, version=${health.version}` : ''}${health.database ? `, db=${health.database}` : ''}.` }],
36
- structuredContent: toStructuredContent(health),
37
- };
24
+ return { content: [], structuredContent: toStructuredContent(health) };
38
25
  } catch (err) {
39
26
  return apiErrorResult(err);
40
27
  }