@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.
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +1 -3
- package/dist/server.js.map +1 -1
- package/dist/tool-scopes.d.ts.map +1 -1
- package/dist/tool-scopes.js +0 -3
- package/dist/tool-scopes.js.map +1 -1
- package/dist/tools/a2a.d.ts.map +1 -1
- package/dist/tools/a2a.js +20 -220
- package/dist/tools/a2a.js.map +1 -1
- package/dist/tools/agent-mandates.d.ts.map +1 -1
- package/dist/tools/agent-mandates.js +10 -74
- package/dist/tools/agent-mandates.js.map +1 -1
- package/dist/tools/agents-refs.d.ts.map +1 -1
- package/dist/tools/agents-refs.js +9 -61
- package/dist/tools/agents-refs.js.map +1 -1
- package/dist/tools/capabilities.d.ts.map +1 -1
- package/dist/tools/capabilities.js +2 -14
- package/dist/tools/capabilities.js.map +1 -1
- package/dist/tools/code-mode.d.ts.map +1 -1
- package/dist/tools/code-mode.js +4 -35
- package/dist/tools/code-mode.js.map +1 -1
- package/dist/tools/compliance.d.ts.map +1 -1
- package/dist/tools/compliance.js +3 -37
- package/dist/tools/compliance.js.map +1 -1
- package/dist/tools/dashboard.d.ts.map +1 -1
- package/dist/tools/dashboard.js +3 -37
- package/dist/tools/dashboard.js.map +1 -1
- package/dist/tools/disputes.d.ts.map +1 -1
- package/dist/tools/disputes.js +4 -41
- package/dist/tools/disputes.js.map +1 -1
- package/dist/tools/enterprises.d.ts.map +1 -1
- package/dist/tools/enterprises.js +6 -62
- package/dist/tools/enterprises.js.map +1 -1
- package/dist/tools/events.d.ts.map +1 -1
- package/dist/tools/events.js +1 -19
- package/dist/tools/events.js.map +1 -1
- package/dist/tools/federation-admin.d.ts.map +1 -1
- package/dist/tools/federation-admin.js +24 -256
- package/dist/tools/federation-admin.js.map +1 -1
- package/dist/tools/federation.d.ts.map +1 -1
- package/dist/tools/federation.js +20 -197
- package/dist/tools/federation.js.map +1 -1
- package/dist/tools/health.d.ts.map +1 -1
- package/dist/tools/health.js +1 -13
- package/dist/tools/health.js.map +1 -1
- package/dist/tools/mandates.d.ts.map +1 -1
- package/dist/tools/mandates.js +10 -93
- package/dist/tools/mandates.js.map +1 -1
- package/dist/tools/openclaw.d.ts.map +1 -1
- package/dist/tools/openclaw.js +5 -32
- package/dist/tools/openclaw.js.map +1 -1
- package/dist/tools/receipts.d.ts.map +1 -1
- package/dist/tools/receipts.js +4 -94
- package/dist/tools/receipts.js.map +1 -1
- package/dist/tools/reputation.d.ts.map +1 -1
- package/dist/tools/reputation.js +3 -33
- package/dist/tools/reputation.js.map +1 -1
- package/dist/tools/schemas.d.ts.map +1 -1
- package/dist/tools/schemas.js +16 -186
- package/dist/tools/schemas.js.map +1 -1
- package/dist/tools/verification-keys.d.ts.map +1 -1
- package/dist/tools/verification-keys.js +1 -22
- package/dist/tools/verification-keys.js.map +1 -1
- package/dist/tools/verification.d.ts.map +1 -1
- package/dist/tools/verification.js +2 -27
- package/dist/tools/verification.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -3
- package/src/server.ts +3 -5
- package/src/tool-scopes.ts +0 -4
- package/src/tools/a2a.ts +20 -233
- package/src/tools/agent-mandates.ts +10 -76
- package/src/tools/agents-refs.ts +9 -65
- package/src/tools/capabilities.ts +2 -15
- package/src/tools/compliance.ts +3 -37
- package/src/tools/dashboard.ts +3 -37
- package/src/tools/disputes.ts +4 -42
- package/src/tools/enterprises.ts +6 -62
- package/src/tools/events.ts +1 -20
- package/src/tools/federation-admin.ts +24 -281
- package/src/tools/federation.ts +20 -217
- package/src/tools/health.ts +1 -14
- package/src/tools/mandates.ts +10 -95
- package/src/tools/openclaw.ts +5 -51
- package/src/tools/receipts.ts +4 -95
- package/src/tools/reputation.ts +3 -34
- package/src/tools/schemas.ts +16 -194
- package/src/tools/verification-keys.ts +1 -24
- package/src/tools/verification.ts +2 -29
- package/tests/conformance.test.ts +4 -26
- package/tests/conformance.ts +3 -13
- package/tests/profiles.test.ts +2 -17
- package/tests/tools/a2a.test.ts +0 -28
- package/tests/tools/agent-mandates.test.ts +0 -10
- package/tests/tools/agents-refs.test.ts +0 -9
- package/tests/tools/capabilities.test.ts +0 -6
- package/tests/tools/compliance.test.ts +0 -8
- package/tests/tools/dashboard.test.ts +0 -9
- package/tests/tools/disputes.test.ts +0 -8
- package/tests/tools/enterprises.test.ts +0 -10
- package/tests/tools/events.test.ts +0 -5
- package/tests/tools/federation-admin.test.ts +0 -41
- package/tests/tools/federation.test.ts +0 -34
- package/tests/tools/health.test.ts +1 -12
- package/tests/tools/mandates.test.ts +0 -12
- package/tests/tools/openclaw.test.ts +0 -12
- package/tests/tools/receipts.test.ts +1 -14
- package/tests/tools/reputation.test.ts +0 -9
- package/tests/tools/schemas.test.ts +0 -23
- package/tests/tools/verification-keys.test.ts +0 -6
- package/tests/tools/verification.test.ts +1 -11
- package/src/tools/code-mode.ts +0 -461
- package/tests/drift/code-mode-manifest.test.ts +0 -144
- package/tests/integration/output-schema-validation.test.ts +0 -167
- package/tests/tools/code-mode.test.ts +0 -168
package/src/tools/disputes.ts
CHANGED
|
@@ -3,24 +3,6 @@ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
|
3
3
|
import type { AgledgerClient } from '@agledger/sdk';
|
|
4
4
|
import { apiErrorResult, toStructuredContent } from '../errors.js';
|
|
5
5
|
import { toolMeta } from '../tool-scopes.js';
|
|
6
|
-
import { DisputeStatusEnum, NextStepsField } from '../enums.js';
|
|
7
|
-
|
|
8
|
-
const DisputeOutputSchema = z.object({
|
|
9
|
-
id: z.string().describe('Dispute UUID'),
|
|
10
|
-
mandateId: z.string().describe('Associated mandate UUID'),
|
|
11
|
-
receiptId: z.string().describe('Associated receipt UUID'),
|
|
12
|
-
status: DisputeStatusEnum,
|
|
13
|
-
reason: z.string().describe('Dispute reason/grounds'),
|
|
14
|
-
evidence: z.record(z.string(), z.unknown()).nullable().optional().describe('Supporting evidence'),
|
|
15
|
-
currentTier: z.number().describe('Current dispute resolution tier (1-3)'),
|
|
16
|
-
tierHistory: z.array(z.record(z.string(), z.unknown())).nullable().optional().describe('History of tier transitions'),
|
|
17
|
-
resolution: z.string().nullable().optional().describe('Resolution description'),
|
|
18
|
-
amount: z.number().nullable().optional().describe('Settlement amount if applicable'),
|
|
19
|
-
createdAt: z.string().describe('ISO 8601 creation timestamp'),
|
|
20
|
-
updatedAt: z.string().nullable().optional().describe('ISO 8601 last update timestamp'),
|
|
21
|
-
resolvedAt: z.string().nullable().optional().describe('ISO 8601 resolution timestamp'),
|
|
22
|
-
nextSteps: NextStepsField,
|
|
23
|
-
}).passthrough().describe('AGLedger dispute object');
|
|
24
6
|
|
|
25
7
|
export function registerDisputeTools(mcp: McpServer, client: AgledgerClient): void {
|
|
26
8
|
mcp.registerTool(
|
|
@@ -33,7 +15,6 @@ export function registerDisputeTools(mcp: McpServer, client: AgledgerClient): vo
|
|
|
33
15
|
grounds: z.string().describe('Dispute grounds (e.g. "pricing_dispute", "mandate_ambiguity")'),
|
|
34
16
|
context: z.string().optional().describe('Additional context for the dispute'),
|
|
35
17
|
},
|
|
36
|
-
outputSchema: DisputeOutputSchema,
|
|
37
18
|
annotations: {
|
|
38
19
|
readOnlyHint: false,
|
|
39
20
|
destructiveHint: false,
|
|
@@ -46,10 +27,7 @@ export function registerDisputeTools(mcp: McpServer, client: AgledgerClient): vo
|
|
|
46
27
|
try {
|
|
47
28
|
const { mandateId, ...disputeParams } = args;
|
|
48
29
|
const dispute = await client.disputes.create(mandateId, disputeParams);
|
|
49
|
-
return {
|
|
50
|
-
content: [{ type: 'text', text: `Dispute ${dispute.id} opened on mandate ${mandateId}. Status: ${dispute.status}, tier: ${dispute.currentTier}.` }],
|
|
51
|
-
structuredContent: toStructuredContent(dispute),
|
|
52
|
-
};
|
|
30
|
+
return { content: [], structuredContent: toStructuredContent(dispute) };
|
|
53
31
|
} catch (err) {
|
|
54
32
|
return apiErrorResult(err);
|
|
55
33
|
}
|
|
@@ -64,7 +42,6 @@ export function registerDisputeTools(mcp: McpServer, client: AgledgerClient): vo
|
|
|
64
42
|
inputSchema: {
|
|
65
43
|
mandateId: z.string().describe('UUID of the mandate with the dispute'),
|
|
66
44
|
},
|
|
67
|
-
outputSchema: DisputeOutputSchema,
|
|
68
45
|
annotations: {
|
|
69
46
|
readOnlyHint: true,
|
|
70
47
|
destructiveHint: false,
|
|
@@ -77,10 +54,7 @@ export function registerDisputeTools(mcp: McpServer, client: AgledgerClient): vo
|
|
|
77
54
|
try {
|
|
78
55
|
const result = await client.disputes.get(args.mandateId);
|
|
79
56
|
const dispute = result.dispute;
|
|
80
|
-
return {
|
|
81
|
-
content: [{ type: 'text', text: `Dispute ${dispute.id}: status=${dispute.status}, tier=${dispute.currentTier}, grounds="${dispute.grounds}". ${result.evidence?.length ?? 0} evidence item(s).` }],
|
|
82
|
-
structuredContent: toStructuredContent(dispute),
|
|
83
|
-
};
|
|
57
|
+
return { content: [], structuredContent: toStructuredContent(dispute) };
|
|
84
58
|
} catch (err) {
|
|
85
59
|
return apiErrorResult(err);
|
|
86
60
|
}
|
|
@@ -95,7 +69,6 @@ export function registerDisputeTools(mcp: McpServer, client: AgledgerClient): vo
|
|
|
95
69
|
inputSchema: {
|
|
96
70
|
mandateId: z.string().describe('UUID of the mandate whose dispute to escalate'),
|
|
97
71
|
},
|
|
98
|
-
outputSchema: DisputeOutputSchema,
|
|
99
72
|
annotations: {
|
|
100
73
|
readOnlyHint: false,
|
|
101
74
|
destructiveHint: false,
|
|
@@ -107,10 +80,7 @@ export function registerDisputeTools(mcp: McpServer, client: AgledgerClient): vo
|
|
|
107
80
|
async (args) => {
|
|
108
81
|
try {
|
|
109
82
|
const dispute = await client.disputes.escalate(args.mandateId);
|
|
110
|
-
return {
|
|
111
|
-
content: [{ type: 'text', text: `Dispute on mandate ${args.mandateId} escalated to tier ${dispute.currentTier}. Status: ${dispute.status}.` }],
|
|
112
|
-
structuredContent: toStructuredContent(dispute),
|
|
113
|
-
};
|
|
83
|
+
return { content: [], structuredContent: toStructuredContent(dispute) };
|
|
114
84
|
} catch (err) {
|
|
115
85
|
return apiErrorResult(err);
|
|
116
86
|
}
|
|
@@ -127,11 +97,6 @@ export function registerDisputeTools(mcp: McpServer, client: AgledgerClient): vo
|
|
|
127
97
|
evidenceType: z.enum(['screenshot', 'external_lookup', 'document', 'communication', 'other']).describe('Type of evidence being submitted'),
|
|
128
98
|
payload: z.record(z.string(), z.unknown()).describe('Evidence payload object'),
|
|
129
99
|
},
|
|
130
|
-
outputSchema: z.object({
|
|
131
|
-
id: z.string().describe('Evidence record ID'),
|
|
132
|
-
evidenceType: z.string().describe('Type of evidence submitted'),
|
|
133
|
-
createdAt: z.string().nullable().optional().describe('ISO 8601 creation timestamp'),
|
|
134
|
-
}).passthrough().describe('Submitted dispute evidence confirmation'),
|
|
135
100
|
annotations: {
|
|
136
101
|
readOnlyHint: false,
|
|
137
102
|
destructiveHint: false,
|
|
@@ -146,10 +111,7 @@ export function registerDisputeTools(mcp: McpServer, client: AgledgerClient): vo
|
|
|
146
111
|
evidenceType: args.evidenceType,
|
|
147
112
|
payload: args.payload,
|
|
148
113
|
});
|
|
149
|
-
return {
|
|
150
|
-
content: [{ type: 'text', text: `Evidence submitted for dispute on mandate ${args.mandateId}. Type: ${args.evidenceType}.` }],
|
|
151
|
-
structuredContent: toStructuredContent(result),
|
|
152
|
-
};
|
|
114
|
+
return { content: [], structuredContent: toStructuredContent(result) };
|
|
153
115
|
} catch (err) {
|
|
154
116
|
return apiErrorResult(err);
|
|
155
117
|
}
|
package/src/tools/enterprises.ts
CHANGED
|
@@ -15,12 +15,6 @@ export function registerEnterpriseTools(mcp: McpServer, client: AgledgerClient):
|
|
|
15
15
|
agentId: z.string().describe('Agent ID to approve'),
|
|
16
16
|
reason: z.string().optional().describe('Reason for approval'),
|
|
17
17
|
},
|
|
18
|
-
outputSchema: z.object({
|
|
19
|
-
agentId: z.string().describe('Approved agent ID'),
|
|
20
|
-
enterpriseId: z.string().describe('Enterprise ID'),
|
|
21
|
-
status: z.string().describe('Agent approval status'),
|
|
22
|
-
approvedAt: z.string().nullable().optional().describe('ISO 8601 approval timestamp'),
|
|
23
|
-
}).passthrough().describe('Enterprise agent approval result'),
|
|
24
18
|
annotations: {
|
|
25
19
|
readOnlyHint: false,
|
|
26
20
|
destructiveHint: false,
|
|
@@ -34,10 +28,7 @@ export function registerEnterpriseTools(mcp: McpServer, client: AgledgerClient):
|
|
|
34
28
|
const record = await client.enterprises.approveAgent(args.enterpriseId, args.agentId, {
|
|
35
29
|
reason: args.reason,
|
|
36
30
|
});
|
|
37
|
-
return {
|
|
38
|
-
content: [{ type: 'text', text: `Agent ${args.agentId} approved for enterprise ${args.enterpriseId}.` }],
|
|
39
|
-
structuredContent: toStructuredContent(record),
|
|
40
|
-
};
|
|
31
|
+
return { content: [], structuredContent: toStructuredContent(record) };
|
|
41
32
|
} catch (err) {
|
|
42
33
|
return apiErrorResult(err);
|
|
43
34
|
}
|
|
@@ -54,11 +45,6 @@ export function registerEnterpriseTools(mcp: McpServer, client: AgledgerClient):
|
|
|
54
45
|
agentId: z.string().describe('Agent ID to revoke'),
|
|
55
46
|
reason: z.string().optional().describe('Reason for revocation'),
|
|
56
47
|
},
|
|
57
|
-
outputSchema: z.object({
|
|
58
|
-
enterpriseId: z.string().describe('Enterprise ID'),
|
|
59
|
-
agentId: z.string().describe('Revoked agent ID'),
|
|
60
|
-
status: z.string().describe('Agent status after revocation'),
|
|
61
|
-
}).passthrough().describe('Enterprise agent revocation result'),
|
|
62
48
|
annotations: {
|
|
63
49
|
readOnlyHint: false,
|
|
64
50
|
destructiveHint: true,
|
|
@@ -72,10 +58,7 @@ export function registerEnterpriseTools(mcp: McpServer, client: AgledgerClient):
|
|
|
72
58
|
await client.enterprises.revokeAgent(args.enterpriseId, args.agentId, {
|
|
73
59
|
reason: args.reason,
|
|
74
60
|
});
|
|
75
|
-
return {
|
|
76
|
-
content: [{ type: 'text', text: `Agent ${args.agentId} revoked from enterprise ${args.enterpriseId}.` }],
|
|
77
|
-
structuredContent: { enterpriseId: args.enterpriseId, agentId: args.agentId, status: 'revoked' },
|
|
78
|
-
};
|
|
61
|
+
return { content: [], structuredContent: { enterpriseId: args.enterpriseId, agentId: args.agentId, status: 'revoked' } };
|
|
79
62
|
} catch (err) {
|
|
80
63
|
return apiErrorResult(err);
|
|
81
64
|
}
|
|
@@ -93,15 +76,6 @@ export function registerEnterpriseTools(mcp: McpServer, client: AgledgerClient):
|
|
|
93
76
|
limit: z.number().optional().describe('Page size'),
|
|
94
77
|
offset: z.number().optional().describe('Page offset'),
|
|
95
78
|
},
|
|
96
|
-
outputSchema: z.object({
|
|
97
|
-
data: z.array(z.object({
|
|
98
|
-
agentId: z.string().describe('Agent ID'),
|
|
99
|
-
status: z.string().describe('Agent approval status'),
|
|
100
|
-
}).passthrough()).describe('Array of enterprise agents'),
|
|
101
|
-
total: z.number().nullable().optional().describe('Total count of matching agents'),
|
|
102
|
-
limit: z.number().nullable().optional().describe('Page size'),
|
|
103
|
-
offset: z.number().nullable().optional().describe('Page offset'),
|
|
104
|
-
}).passthrough().describe('Paginated list of enterprise agents'),
|
|
105
79
|
annotations: {
|
|
106
80
|
readOnlyHint: true,
|
|
107
81
|
destructiveHint: false,
|
|
@@ -117,10 +91,7 @@ export function registerEnterpriseTools(mcp: McpServer, client: AgledgerClient):
|
|
|
117
91
|
limit: args.limit,
|
|
118
92
|
offset: args.offset,
|
|
119
93
|
});
|
|
120
|
-
return {
|
|
121
|
-
content: [{ type: 'text', text: `Found ${result.data.length} agents for enterprise ${args.enterpriseId}.` }],
|
|
122
|
-
structuredContent: toStructuredContent(result),
|
|
123
|
-
};
|
|
94
|
+
return { content: [], structuredContent: toStructuredContent(result) };
|
|
124
95
|
} catch (err) {
|
|
125
96
|
return apiErrorResult(err);
|
|
126
97
|
}
|
|
@@ -141,13 +112,6 @@ export function registerEnterpriseTools(mcp: McpServer, client: AgledgerClient):
|
|
|
141
112
|
email: z.string().optional().describe('Contact email'),
|
|
142
113
|
trustLevel: z.enum(['sandbox', 'active', 'verified']).optional().describe('Initial trust level (default: sandbox)'),
|
|
143
114
|
},
|
|
144
|
-
outputSchema: {
|
|
145
|
-
id: z.string().describe('Enterprise UUID'),
|
|
146
|
-
name: z.string().describe('Enterprise display name'),
|
|
147
|
-
slug: z.string().describe('URL-safe identifier'),
|
|
148
|
-
trustLevel: z.string(),
|
|
149
|
-
createdAt: z.string().describe('ISO 8601 creation timestamp'),
|
|
150
|
-
},
|
|
151
115
|
annotations: {
|
|
152
116
|
readOnlyHint: false,
|
|
153
117
|
destructiveHint: false,
|
|
@@ -159,10 +123,7 @@ export function registerEnterpriseTools(mcp: McpServer, client: AgledgerClient):
|
|
|
159
123
|
async (args) => {
|
|
160
124
|
try {
|
|
161
125
|
const enterprise = await client.admin.createEnterprise({ name: args.name, slug: args.slug });
|
|
162
|
-
return {
|
|
163
|
-
content: [{ type: 'text', text: `Enterprise "${enterprise.name}" created (${enterprise.id}, slug: ${enterprise.slug}). Next: create an API key with POST /v1/admin/api-keys, then register agents.` }],
|
|
164
|
-
structuredContent: toStructuredContent(enterprise),
|
|
165
|
-
};
|
|
126
|
+
return { content: [], structuredContent: toStructuredContent(enterprise) };
|
|
166
127
|
} catch (err) {
|
|
167
128
|
return apiErrorResult(err);
|
|
168
129
|
}
|
|
@@ -185,13 +146,6 @@ export function registerEnterpriseTools(mcp: McpServer, client: AgledgerClient):
|
|
|
185
146
|
email: z.string().optional().describe('Contact email'),
|
|
186
147
|
trustLevel: z.enum(['sandbox', 'active', 'verified']).optional().describe('Initial trust level (default: sandbox)'),
|
|
187
148
|
},
|
|
188
|
-
outputSchema: {
|
|
189
|
-
id: z.string().describe('Agent UUID'),
|
|
190
|
-
displayName: z.string().nullable().describe('Agent display name'),
|
|
191
|
-
slug: z.string().describe('URL-safe identifier'),
|
|
192
|
-
trustLevel: z.string(),
|
|
193
|
-
createdAt: z.string().describe('ISO 8601 creation timestamp'),
|
|
194
|
-
},
|
|
195
149
|
annotations: {
|
|
196
150
|
readOnlyHint: false,
|
|
197
151
|
destructiveHint: false,
|
|
@@ -207,10 +161,7 @@ export function registerEnterpriseTools(mcp: McpServer, client: AgledgerClient):
|
|
|
207
161
|
slug: args.slug,
|
|
208
162
|
enterpriseId: args.enterpriseId,
|
|
209
163
|
});
|
|
210
|
-
return {
|
|
211
|
-
content: [{ type: 'text', text: `Agent "${agent.displayName}" created (${agent.id}, slug: ${agent.slug}). Next: create an API key with POST /v1/admin/api-keys, then set capabilities.` }],
|
|
212
|
-
structuredContent: toStructuredContent(agent),
|
|
213
|
-
};
|
|
164
|
+
return { content: [], structuredContent: toStructuredContent(agent) };
|
|
214
165
|
} catch (err) {
|
|
215
166
|
return apiErrorResult(err);
|
|
216
167
|
}
|
|
@@ -232,10 +183,6 @@ export function registerEnterpriseTools(mcp: McpServer, client: AgledgerClient):
|
|
|
232
183
|
'allowSelfApproval (boolean), defaultScopes (string[])',
|
|
233
184
|
),
|
|
234
185
|
},
|
|
235
|
-
outputSchema: z.object({
|
|
236
|
-
enterpriseId: z.string().nullable().optional().describe('Enterprise ID'),
|
|
237
|
-
config: z.record(z.string(), z.unknown()).nullable().optional().describe('Applied configuration'),
|
|
238
|
-
}).passthrough().describe('Enterprise configuration update result'),
|
|
239
186
|
annotations: {
|
|
240
187
|
readOnlyHint: false,
|
|
241
188
|
destructiveHint: false,
|
|
@@ -247,10 +194,7 @@ export function registerEnterpriseTools(mcp: McpServer, client: AgledgerClient):
|
|
|
247
194
|
async (args) => {
|
|
248
195
|
try {
|
|
249
196
|
const result = await client.admin.setEnterpriseConfig(args.enterpriseId, args.config);
|
|
250
|
-
return {
|
|
251
|
-
content: [{ type: 'text', text: `Configuration replaced for enterprise ${args.enterpriseId}.` }],
|
|
252
|
-
structuredContent: toStructuredContent(result),
|
|
253
|
-
};
|
|
197
|
+
return { content: [], structuredContent: toStructuredContent(result) };
|
|
254
198
|
} catch (err) {
|
|
255
199
|
return apiErrorResult(err);
|
|
256
200
|
}
|
package/src/tools/events.ts
CHANGED
|
@@ -4,21 +4,6 @@ import type { AgledgerClient } from '@agledger/sdk';
|
|
|
4
4
|
import { apiErrorResult, toStructuredContent } from '../errors.js';
|
|
5
5
|
import { toolMeta } from '../tool-scopes.js';
|
|
6
6
|
|
|
7
|
-
const AuditChainOutputSchema = z.object({
|
|
8
|
-
mandateId: z.string().describe('Mandate UUID'),
|
|
9
|
-
chainStart: z.string().describe('ISO 8601 timestamp of the first audit entry'),
|
|
10
|
-
entries: z.array(z.object({
|
|
11
|
-
index: z.number().describe('Entry index in the chain'),
|
|
12
|
-
hash: z.string().describe('SHA-256 hash of this entry'),
|
|
13
|
-
previousHash: z.string().nullable().describe('Hash of the previous entry (null for first)'),
|
|
14
|
-
event: z.string().describe('Event type'),
|
|
15
|
-
actor: z.string().describe('Actor who triggered the event'),
|
|
16
|
-
timestamp: z.string().describe('ISO 8601 timestamp'),
|
|
17
|
-
signature: z.string().optional().describe('Optional cryptographic signature'),
|
|
18
|
-
})).describe('Ordered chain of audit entries'),
|
|
19
|
-
isValid: z.boolean().describe('Whether the hash chain is valid (tamper-proof check)'),
|
|
20
|
-
}).passthrough().describe('Hash-chained audit trail for a mandate');
|
|
21
|
-
|
|
22
7
|
export function registerEventTools(mcp: McpServer, client: AgledgerClient): void {
|
|
23
8
|
mcp.registerTool(
|
|
24
9
|
'get_audit_trail',
|
|
@@ -28,7 +13,6 @@ export function registerEventTools(mcp: McpServer, client: AgledgerClient): void
|
|
|
28
13
|
inputSchema: {
|
|
29
14
|
mandateId: z.string().describe('UUID of the mandate to get the audit trail for'),
|
|
30
15
|
},
|
|
31
|
-
outputSchema: AuditChainOutputSchema,
|
|
32
16
|
annotations: {
|
|
33
17
|
readOnlyHint: true,
|
|
34
18
|
destructiveHint: false,
|
|
@@ -40,10 +24,7 @@ export function registerEventTools(mcp: McpServer, client: AgledgerClient): void
|
|
|
40
24
|
async (args) => {
|
|
41
25
|
try {
|
|
42
26
|
const chain = await client.events.getAuditChain(args.mandateId);
|
|
43
|
-
return {
|
|
44
|
-
content: [{ type: 'text', text: `Audit trail for mandate ${chain.mandateId}: ${chain.entries.length} entries, chain valid=${chain.isValid}.` }],
|
|
45
|
-
structuredContent: toStructuredContent(chain),
|
|
46
|
-
};
|
|
27
|
+
return { content: [], structuredContent: toStructuredContent(chain) };
|
|
47
28
|
} catch (err) {
|
|
48
29
|
return apiErrorResult(err);
|
|
49
30
|
}
|