@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
|
@@ -3,35 +3,7 @@ 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 { ContractTypeEnum
|
|
7
|
-
|
|
8
|
-
const MandateOutputSchema = z.object({
|
|
9
|
-
id: z.string(),
|
|
10
|
-
enterpriseId: z.string(),
|
|
11
|
-
agentId: z.string().nullable().optional(),
|
|
12
|
-
contractType: ContractTypeEnum,
|
|
13
|
-
contractVersion: z.string(),
|
|
14
|
-
platform: z.string(),
|
|
15
|
-
status: z.string(),
|
|
16
|
-
criteria: z.record(z.string(), z.unknown()),
|
|
17
|
-
tolerance: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
18
|
-
deadline: z.string().nullable().optional(),
|
|
19
|
-
commissionPct: z.number().nullable().optional(),
|
|
20
|
-
parentMandateId: z.string().nullable().optional(),
|
|
21
|
-
rootMandateId: z.string().nullable().optional(),
|
|
22
|
-
chainDepth: z.number().nullable().optional(),
|
|
23
|
-
version: z.number(),
|
|
24
|
-
createdAt: z.string(),
|
|
25
|
-
updatedAt: z.string(),
|
|
26
|
-
nextSteps: NextStepsField,
|
|
27
|
-
}).passthrough().describe('AGLedger mandate object');
|
|
28
|
-
|
|
29
|
-
const PageOutputSchema = z.object({
|
|
30
|
-
data: z.array(MandateOutputSchema),
|
|
31
|
-
hasMore: z.boolean(),
|
|
32
|
-
nextCursor: z.string().nullable().optional(),
|
|
33
|
-
total: z.number().optional(),
|
|
34
|
-
}).describe('Paginated mandate results');
|
|
6
|
+
import { ContractTypeEnum } from '../enums.js';
|
|
35
7
|
|
|
36
8
|
export function registerAgentMandateTools(mcp: McpServer, client: AgledgerClient): void {
|
|
37
9
|
mcp.registerTool(
|
|
@@ -51,7 +23,6 @@ export function registerAgentMandateTools(mcp: McpServer, client: AgledgerClient
|
|
|
51
23
|
commissionPct: z.number().optional().describe('Commission percentage (0-100)'),
|
|
52
24
|
deadline: z.string().optional().describe('ISO 8601 deadline'),
|
|
53
25
|
},
|
|
54
|
-
outputSchema: MandateOutputSchema,
|
|
55
26
|
annotations: {
|
|
56
27
|
readOnlyHint: false,
|
|
57
28
|
destructiveHint: false,
|
|
@@ -63,10 +34,7 @@ export function registerAgentMandateTools(mcp: McpServer, client: AgledgerClient
|
|
|
63
34
|
async (args) => {
|
|
64
35
|
try {
|
|
65
36
|
const mandate = await client.mandates.createAgent(args);
|
|
66
|
-
return {
|
|
67
|
-
content: [{ type: 'text', text: `Mandate ${mandate.id} proposed (${mandate.status}).` }],
|
|
68
|
-
structuredContent: toStructuredContent(mandate),
|
|
69
|
-
};
|
|
37
|
+
return { content: [], structuredContent: toStructuredContent(mandate) };
|
|
70
38
|
} catch (err) {
|
|
71
39
|
return apiErrorResult(err);
|
|
72
40
|
}
|
|
@@ -81,7 +49,6 @@ export function registerAgentMandateTools(mcp: McpServer, client: AgledgerClient
|
|
|
81
49
|
inputSchema: {
|
|
82
50
|
mandateId: z.string().describe('UUID of the proposed mandate'),
|
|
83
51
|
},
|
|
84
|
-
outputSchema: MandateOutputSchema,
|
|
85
52
|
annotations: {
|
|
86
53
|
readOnlyHint: false,
|
|
87
54
|
destructiveHint: false,
|
|
@@ -93,10 +60,7 @@ export function registerAgentMandateTools(mcp: McpServer, client: AgledgerClient
|
|
|
93
60
|
async (args) => {
|
|
94
61
|
try {
|
|
95
62
|
const mandate = await client.mandates.accept(args.mandateId);
|
|
96
|
-
return {
|
|
97
|
-
content: [{ type: 'text', text: `Mandate ${mandate.id} accepted (${mandate.status}).` }],
|
|
98
|
-
structuredContent: toStructuredContent(mandate),
|
|
99
|
-
};
|
|
63
|
+
return { content: [], structuredContent: toStructuredContent(mandate) };
|
|
100
64
|
} catch (err) {
|
|
101
65
|
return apiErrorResult(err);
|
|
102
66
|
}
|
|
@@ -112,7 +76,6 @@ export function registerAgentMandateTools(mcp: McpServer, client: AgledgerClient
|
|
|
112
76
|
mandateId: z.string().describe('UUID of the proposed mandate'),
|
|
113
77
|
reason: z.string().optional().describe('Reason for rejection'),
|
|
114
78
|
},
|
|
115
|
-
outputSchema: MandateOutputSchema,
|
|
116
79
|
annotations: {
|
|
117
80
|
readOnlyHint: false,
|
|
118
81
|
destructiveHint: true,
|
|
@@ -124,10 +87,7 @@ export function registerAgentMandateTools(mcp: McpServer, client: AgledgerClient
|
|
|
124
87
|
async (args) => {
|
|
125
88
|
try {
|
|
126
89
|
const mandate = await client.mandates.reject(args.mandateId, args.reason);
|
|
127
|
-
return {
|
|
128
|
-
content: [{ type: 'text', text: `Mandate ${mandate.id} rejected (${mandate.status}).` }],
|
|
129
|
-
structuredContent: toStructuredContent(mandate),
|
|
130
|
-
};
|
|
90
|
+
return { content: [], structuredContent: toStructuredContent(mandate) };
|
|
131
91
|
} catch (err) {
|
|
132
92
|
return apiErrorResult(err);
|
|
133
93
|
}
|
|
@@ -147,7 +107,6 @@ export function registerAgentMandateTools(mcp: McpServer, client: AgledgerClient
|
|
|
147
107
|
counterCommissionPct: z.number().optional().describe('Modified commission percentage'),
|
|
148
108
|
message: z.string().optional().describe('Message explaining the counter-proposal'),
|
|
149
109
|
},
|
|
150
|
-
outputSchema: MandateOutputSchema,
|
|
151
110
|
annotations: {
|
|
152
111
|
readOnlyHint: false,
|
|
153
112
|
destructiveHint: false,
|
|
@@ -165,10 +124,7 @@ export function registerAgentMandateTools(mcp: McpServer, client: AgledgerClient
|
|
|
165
124
|
counterDeadline: args.counterDeadline,
|
|
166
125
|
counterCommissionPct: args.counterCommissionPct ?? undefined,
|
|
167
126
|
});
|
|
168
|
-
return {
|
|
169
|
-
content: [{ type: 'text', text: `Mandate ${mandate.id} counter-proposed (${mandate.status}).` }],
|
|
170
|
-
structuredContent: toStructuredContent(mandate),
|
|
171
|
-
};
|
|
127
|
+
return { content: [], structuredContent: toStructuredContent(mandate) };
|
|
172
128
|
} catch (err) {
|
|
173
129
|
return apiErrorResult(err);
|
|
174
130
|
}
|
|
@@ -183,7 +139,6 @@ export function registerAgentMandateTools(mcp: McpServer, client: AgledgerClient
|
|
|
183
139
|
inputSchema: {
|
|
184
140
|
mandateId: z.string().describe('UUID of the counter-proposed mandate'),
|
|
185
141
|
},
|
|
186
|
-
outputSchema: MandateOutputSchema,
|
|
187
142
|
annotations: {
|
|
188
143
|
readOnlyHint: false,
|
|
189
144
|
destructiveHint: false,
|
|
@@ -195,10 +150,7 @@ export function registerAgentMandateTools(mcp: McpServer, client: AgledgerClient
|
|
|
195
150
|
async (args) => {
|
|
196
151
|
try {
|
|
197
152
|
const mandate = await client.mandates.acceptCounter(args.mandateId);
|
|
198
|
-
return {
|
|
199
|
-
content: [{ type: 'text', text: `Counter-proposal on ${mandate.id} accepted (${mandate.status}).` }],
|
|
200
|
-
structuredContent: toStructuredContent(mandate),
|
|
201
|
-
};
|
|
153
|
+
return { content: [], structuredContent: toStructuredContent(mandate) };
|
|
202
154
|
} catch (err) {
|
|
203
155
|
return apiErrorResult(err);
|
|
204
156
|
}
|
|
@@ -211,7 +163,6 @@ export function registerAgentMandateTools(mcp: McpServer, client: AgledgerClient
|
|
|
211
163
|
title: 'List My Proposals',
|
|
212
164
|
description: 'List mandate proposals awaiting my response as performer.',
|
|
213
165
|
inputSchema: {},
|
|
214
|
-
outputSchema: PageOutputSchema,
|
|
215
166
|
annotations: {
|
|
216
167
|
readOnlyHint: true,
|
|
217
168
|
destructiveHint: false,
|
|
@@ -223,10 +174,7 @@ export function registerAgentMandateTools(mcp: McpServer, client: AgledgerClient
|
|
|
223
174
|
async () => {
|
|
224
175
|
try {
|
|
225
176
|
const result = await client.mandates.listProposals();
|
|
226
|
-
return {
|
|
227
|
-
content: [{ type: 'text', text: `Found ${result.data.length} proposals.` }],
|
|
228
|
-
structuredContent: toStructuredContent(result),
|
|
229
|
-
};
|
|
177
|
+
return { content: [], structuredContent: toStructuredContent(result) };
|
|
230
178
|
} catch (err) {
|
|
231
179
|
return apiErrorResult(err);
|
|
232
180
|
}
|
|
@@ -239,7 +187,6 @@ export function registerAgentMandateTools(mcp: McpServer, client: AgledgerClient
|
|
|
239
187
|
title: 'List Principal Mandates',
|
|
240
188
|
description: 'List mandates where I am the principal (the one who proposed/created them).',
|
|
241
189
|
inputSchema: {},
|
|
242
|
-
outputSchema: PageOutputSchema,
|
|
243
190
|
annotations: {
|
|
244
191
|
readOnlyHint: true,
|
|
245
192
|
destructiveHint: false,
|
|
@@ -251,10 +198,7 @@ export function registerAgentMandateTools(mcp: McpServer, client: AgledgerClient
|
|
|
251
198
|
async () => {
|
|
252
199
|
try {
|
|
253
200
|
const result = await client.mandates.listAsPrincipal();
|
|
254
|
-
return {
|
|
255
|
-
content: [{ type: 'text', text: `Found ${result.data.length} mandates as principal.` }],
|
|
256
|
-
structuredContent: toStructuredContent(result),
|
|
257
|
-
};
|
|
201
|
+
return { content: [], structuredContent: toStructuredContent(result) };
|
|
258
202
|
} catch (err) {
|
|
259
203
|
return apiErrorResult(err);
|
|
260
204
|
}
|
|
@@ -269,9 +213,6 @@ export function registerAgentMandateTools(mcp: McpServer, client: AgledgerClient
|
|
|
269
213
|
inputSchema: {
|
|
270
214
|
mandateId: z.string().describe('UUID of any mandate in the chain'),
|
|
271
215
|
},
|
|
272
|
-
outputSchema: z.object({
|
|
273
|
-
chain: z.array(MandateOutputSchema),
|
|
274
|
-
}),
|
|
275
216
|
annotations: {
|
|
276
217
|
readOnlyHint: true,
|
|
277
218
|
destructiveHint: false,
|
|
@@ -283,10 +224,7 @@ export function registerAgentMandateTools(mcp: McpServer, client: AgledgerClient
|
|
|
283
224
|
async (args) => {
|
|
284
225
|
try {
|
|
285
226
|
const chain = await client.mandates.getChain(args.mandateId);
|
|
286
|
-
return {
|
|
287
|
-
content: [{ type: 'text', text: `Delegation chain has ${chain.length} mandates.` }],
|
|
288
|
-
structuredContent: toStructuredContent({ chain }),
|
|
289
|
-
};
|
|
227
|
+
return { content: [], structuredContent: toStructuredContent({ chain }) };
|
|
290
228
|
} catch (err) {
|
|
291
229
|
return apiErrorResult(err);
|
|
292
230
|
}
|
|
@@ -301,7 +239,6 @@ export function registerAgentMandateTools(mcp: McpServer, client: AgledgerClient
|
|
|
301
239
|
inputSchema: {
|
|
302
240
|
mandateId: z.string().describe('UUID of the parent mandate'),
|
|
303
241
|
},
|
|
304
|
-
outputSchema: PageOutputSchema,
|
|
305
242
|
annotations: {
|
|
306
243
|
readOnlyHint: true,
|
|
307
244
|
destructiveHint: false,
|
|
@@ -313,10 +250,7 @@ export function registerAgentMandateTools(mcp: McpServer, client: AgledgerClient
|
|
|
313
250
|
async (args) => {
|
|
314
251
|
try {
|
|
315
252
|
const result = await client.mandates.getSubMandates(args.mandateId);
|
|
316
|
-
return {
|
|
317
|
-
content: [{ type: 'text', text: `Found ${result.data.length} sub-mandates.` }],
|
|
318
|
-
structuredContent: toStructuredContent(result),
|
|
319
|
-
};
|
|
253
|
+
return { content: [], structuredContent: toStructuredContent(result) };
|
|
320
254
|
} catch (err) {
|
|
321
255
|
return apiErrorResult(err);
|
|
322
256
|
}
|
package/src/tools/agents-refs.ts
CHANGED
|
@@ -4,33 +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 AgentProfileOutputSchema = z.object({
|
|
8
|
-
agentId: z.string().describe('Unique agent identifier'),
|
|
9
|
-
agentClass: z.string().optional().describe('Agent classification (e.g. "data-processor", "orchestrator")'),
|
|
10
|
-
ownerRef: z.string().optional().describe('Owner or team reference'),
|
|
11
|
-
orgUnit: z.string().optional().describe('Organizational unit'),
|
|
12
|
-
description: z.string().optional().describe('Human-readable agent description'),
|
|
13
|
-
}).describe('Agent profile');
|
|
14
|
-
|
|
15
|
-
const ReferenceSchema = z.object({
|
|
16
|
-
system: z.string().describe('External system name (e.g. "jira", "salesforce", "github")'),
|
|
17
|
-
refType: z.string().describe('Reference type within the system (e.g. "ticket", "case", "issue")'),
|
|
18
|
-
refId: z.string().describe('Identifier in the external system'),
|
|
19
|
-
metadata: z.record(z.string(), z.unknown()).optional().describe('Additional metadata about the reference'),
|
|
20
|
-
}).describe('External reference linking an AGLedger entity to an external system');
|
|
21
|
-
|
|
22
|
-
const ReferencesOutputSchema = z.object({
|
|
23
|
-
references: z.array(ReferenceSchema).describe('List of external references'),
|
|
24
|
-
}).describe('External references for an entity');
|
|
25
|
-
|
|
26
|
-
const LookupOutputSchema = z.object({
|
|
27
|
-
entityType: z.string().optional().describe('Type of entity found (e.g. "agent", "mandate")'),
|
|
28
|
-
entityId: z.string().optional().describe('AGLedger ID of the matched entity'),
|
|
29
|
-
system: z.string().describe('External system name'),
|
|
30
|
-
refType: z.string().describe('Reference type'),
|
|
31
|
-
refId: z.string().describe('External reference ID'),
|
|
32
|
-
}).describe('Reverse lookup result mapping an external reference to an AGLedger entity');
|
|
33
|
-
|
|
34
7
|
export function registerAgentsRefsTools(mcp: McpServer, client: AgledgerClient): void {
|
|
35
8
|
mcp.registerTool(
|
|
36
9
|
'get_agent',
|
|
@@ -42,7 +15,6 @@ export function registerAgentsRefsTools(mcp: McpServer, client: AgledgerClient):
|
|
|
42
15
|
inputSchema: {
|
|
43
16
|
agentId: z.string().describe('Agent ID to retrieve'),
|
|
44
17
|
},
|
|
45
|
-
outputSchema: AgentProfileOutputSchema,
|
|
46
18
|
annotations: {
|
|
47
19
|
readOnlyHint: true,
|
|
48
20
|
destructiveHint: false,
|
|
@@ -54,10 +26,7 @@ export function registerAgentsRefsTools(mcp: McpServer, client: AgledgerClient):
|
|
|
54
26
|
async (args) => {
|
|
55
27
|
try {
|
|
56
28
|
const result = await client.agents.get(args.agentId);
|
|
57
|
-
return {
|
|
58
|
-
content: [{ type: 'text', text: `Agent ${result.id}: class=${result.agentClass ?? 'unset'}, owner=${result.ownerRef ?? 'unset'}.` }],
|
|
59
|
-
structuredContent: toStructuredContent(result),
|
|
60
|
-
};
|
|
29
|
+
return { content: [], structuredContent: toStructuredContent(result) };
|
|
61
30
|
} catch (err) {
|
|
62
31
|
return apiErrorResult(err);
|
|
63
32
|
}
|
|
@@ -79,7 +48,6 @@ export function registerAgentsRefsTools(mcp: McpServer, client: AgledgerClient):
|
|
|
79
48
|
orgUnit: z.string().optional().describe('Organizational unit'),
|
|
80
49
|
description: z.string().optional().describe('Human-readable agent description'),
|
|
81
50
|
},
|
|
82
|
-
outputSchema: AgentProfileOutputSchema,
|
|
83
51
|
annotations: {
|
|
84
52
|
readOnlyHint: false,
|
|
85
53
|
destructiveHint: false,
|
|
@@ -96,10 +64,7 @@ export function registerAgentsRefsTools(mcp: McpServer, client: AgledgerClient):
|
|
|
96
64
|
orgUnit: args.orgUnit,
|
|
97
65
|
description: args.description,
|
|
98
66
|
});
|
|
99
|
-
return {
|
|
100
|
-
content: [{ type: 'text', text: `Agent ${result.id} updated.` }],
|
|
101
|
-
structuredContent: toStructuredContent(result),
|
|
102
|
-
};
|
|
67
|
+
return { content: [], structuredContent: toStructuredContent(result) };
|
|
103
68
|
} catch (err) {
|
|
104
69
|
return apiErrorResult(err);
|
|
105
70
|
}
|
|
@@ -123,7 +88,6 @@ export function registerAgentsRefsTools(mcp: McpServer, client: AgledgerClient):
|
|
|
123
88
|
metadata: z.record(z.string(), z.unknown()).optional().describe('Additional metadata about the reference'),
|
|
124
89
|
})).describe('References to add'),
|
|
125
90
|
},
|
|
126
|
-
outputSchema: ReferencesOutputSchema,
|
|
127
91
|
annotations: {
|
|
128
92
|
readOnlyHint: false,
|
|
129
93
|
destructiveHint: false,
|
|
@@ -135,10 +99,7 @@ export function registerAgentsRefsTools(mcp: McpServer, client: AgledgerClient):
|
|
|
135
99
|
async (args) => {
|
|
136
100
|
try {
|
|
137
101
|
const result = await client.agents.addReferences(args.agentId, args.references);
|
|
138
|
-
return {
|
|
139
|
-
content: [{ type: 'text', text: `Added ${args.references.length} reference(s) to agent ${args.agentId}.` }],
|
|
140
|
-
structuredContent: toStructuredContent(result),
|
|
141
|
-
};
|
|
102
|
+
return { content: [], structuredContent: toStructuredContent(result) };
|
|
142
103
|
} catch (err) {
|
|
143
104
|
return apiErrorResult(err);
|
|
144
105
|
}
|
|
@@ -155,7 +116,6 @@ export function registerAgentsRefsTools(mcp: McpServer, client: AgledgerClient):
|
|
|
155
116
|
inputSchema: {
|
|
156
117
|
agentId: z.string().describe('Agent ID to get references for'),
|
|
157
118
|
},
|
|
158
|
-
outputSchema: ReferencesOutputSchema,
|
|
159
119
|
annotations: {
|
|
160
120
|
readOnlyHint: true,
|
|
161
121
|
destructiveHint: false,
|
|
@@ -167,11 +127,8 @@ export function registerAgentsRefsTools(mcp: McpServer, client: AgledgerClient):
|
|
|
167
127
|
async (args) => {
|
|
168
128
|
try {
|
|
169
129
|
const result = await client.agents.getReferences(args.agentId);
|
|
170
|
-
const
|
|
171
|
-
return {
|
|
172
|
-
content: [{ type: 'text', text: `Agent ${args.agentId} has ${(refs as unknown[]).length} reference(s).` }],
|
|
173
|
-
structuredContent: toStructuredContent(Array.isArray(result) ? { references: result } : result),
|
|
174
|
-
};
|
|
130
|
+
const structured = Array.isArray(result) ? { references: result } : result;
|
|
131
|
+
return { content: [], structuredContent: toStructuredContent(structured) };
|
|
175
132
|
} catch (err) {
|
|
176
133
|
return apiErrorResult(err);
|
|
177
134
|
}
|
|
@@ -191,7 +148,6 @@ export function registerAgentsRefsTools(mcp: McpServer, client: AgledgerClient):
|
|
|
191
148
|
refType: z.string().describe('Reference type within the system (e.g. "ticket", "case", "issue")'),
|
|
192
149
|
refId: z.string().describe('Identifier in the external system'),
|
|
193
150
|
},
|
|
194
|
-
outputSchema: LookupOutputSchema,
|
|
195
151
|
annotations: {
|
|
196
152
|
readOnlyHint: true,
|
|
197
153
|
destructiveHint: false,
|
|
@@ -203,11 +159,7 @@ export function registerAgentsRefsTools(mcp: McpServer, client: AgledgerClient):
|
|
|
203
159
|
async (args) => {
|
|
204
160
|
try {
|
|
205
161
|
const result = await client.references.lookup(args);
|
|
206
|
-
|
|
207
|
-
return {
|
|
208
|
-
content: [{ type: 'text', text: `Found ${structured.entityType ?? 'entity'} ${structured.entityId ?? 'unknown'} for ${args.system}/${args.refType}/${args.refId}.` }],
|
|
209
|
-
structuredContent: structured,
|
|
210
|
-
};
|
|
162
|
+
return { content: [], structuredContent: toStructuredContent(result) };
|
|
211
163
|
} catch (err) {
|
|
212
164
|
return apiErrorResult(err);
|
|
213
165
|
}
|
|
@@ -231,7 +183,6 @@ export function registerAgentsRefsTools(mcp: McpServer, client: AgledgerClient):
|
|
|
231
183
|
metadata: z.record(z.string(), z.unknown()).optional().describe('Additional metadata about the reference'),
|
|
232
184
|
})).describe('References to add'),
|
|
233
185
|
},
|
|
234
|
-
outputSchema: ReferencesOutputSchema,
|
|
235
186
|
annotations: {
|
|
236
187
|
readOnlyHint: false,
|
|
237
188
|
destructiveHint: false,
|
|
@@ -243,10 +194,7 @@ export function registerAgentsRefsTools(mcp: McpServer, client: AgledgerClient):
|
|
|
243
194
|
async (args) => {
|
|
244
195
|
try {
|
|
245
196
|
const result = await client.references.addMandateReferences(args.mandateId, args.references);
|
|
246
|
-
return {
|
|
247
|
-
content: [{ type: 'text', text: `Added ${args.references.length} reference(s) to mandate ${args.mandateId}.` }],
|
|
248
|
-
structuredContent: toStructuredContent(result),
|
|
249
|
-
};
|
|
197
|
+
return { content: [], structuredContent: toStructuredContent(result) };
|
|
250
198
|
} catch (err) {
|
|
251
199
|
return apiErrorResult(err);
|
|
252
200
|
}
|
|
@@ -263,7 +211,6 @@ export function registerAgentsRefsTools(mcp: McpServer, client: AgledgerClient):
|
|
|
263
211
|
inputSchema: {
|
|
264
212
|
mandateId: z.string().describe('Mandate ID to get references for'),
|
|
265
213
|
},
|
|
266
|
-
outputSchema: ReferencesOutputSchema,
|
|
267
214
|
annotations: {
|
|
268
215
|
readOnlyHint: true,
|
|
269
216
|
destructiveHint: false,
|
|
@@ -275,11 +222,8 @@ export function registerAgentsRefsTools(mcp: McpServer, client: AgledgerClient):
|
|
|
275
222
|
async (args) => {
|
|
276
223
|
try {
|
|
277
224
|
const result = await client.references.getMandateReferences(args.mandateId);
|
|
278
|
-
const
|
|
279
|
-
return {
|
|
280
|
-
content: [{ type: 'text', text: `Mandate ${args.mandateId} has ${(refs as unknown[]).length} reference(s).` }],
|
|
281
|
-
structuredContent: toStructuredContent(Array.isArray(result) ? { references: result } : result),
|
|
282
|
-
};
|
|
225
|
+
const structured = Array.isArray(result) ? { references: result } : result;
|
|
226
|
+
return { content: [], structuredContent: toStructuredContent(structured) };
|
|
283
227
|
} catch (err) {
|
|
284
228
|
return apiErrorResult(err);
|
|
285
229
|
}
|
|
@@ -5,11 +5,6 @@ import { apiErrorResult, toStructuredContent } from '../errors.js';
|
|
|
5
5
|
import { toolMeta } from '../tool-scopes.js';
|
|
6
6
|
import { ContractTypeEnum } from '../enums.js';
|
|
7
7
|
|
|
8
|
-
const CapabilitiesOutputSchema = z.object({
|
|
9
|
-
agentId: z.string().describe('Agent ID'),
|
|
10
|
-
capabilities: z.array(ContractTypeEnum).describe('Supported contract types'),
|
|
11
|
-
}).describe('Agent capabilities');
|
|
12
|
-
|
|
13
8
|
export function registerCapabilityTools(mcp: McpServer, client: AgledgerClient): void {
|
|
14
9
|
mcp.registerTool(
|
|
15
10
|
'get_agent_capabilities',
|
|
@@ -19,7 +14,6 @@ export function registerCapabilityTools(mcp: McpServer, client: AgledgerClient):
|
|
|
19
14
|
inputSchema: {
|
|
20
15
|
agentId: z.string().describe('Agent ID to check capabilities for'),
|
|
21
16
|
},
|
|
22
|
-
outputSchema: CapabilitiesOutputSchema,
|
|
23
17
|
annotations: {
|
|
24
18
|
readOnlyHint: true,
|
|
25
19
|
destructiveHint: false,
|
|
@@ -31,10 +25,7 @@ export function registerCapabilityTools(mcp: McpServer, client: AgledgerClient):
|
|
|
31
25
|
async (args) => {
|
|
32
26
|
try {
|
|
33
27
|
const result = await client.capabilities.get(args.agentId);
|
|
34
|
-
return {
|
|
35
|
-
content: [{ type: 'text', text: `Agent ${result.agentId} supports ${result.capabilities.length} contract types.` }],
|
|
36
|
-
structuredContent: toStructuredContent(result),
|
|
37
|
-
};
|
|
28
|
+
return { content: [], structuredContent: toStructuredContent(result) };
|
|
38
29
|
} catch (err) {
|
|
39
30
|
return apiErrorResult(err);
|
|
40
31
|
}
|
|
@@ -50,7 +41,6 @@ export function registerCapabilityTools(mcp: McpServer, client: AgledgerClient):
|
|
|
50
41
|
agentId: z.string().describe('Agent ID to set capabilities for'),
|
|
51
42
|
contractTypes: z.array(ContractTypeEnum).describe('Contract types this agent supports'),
|
|
52
43
|
},
|
|
53
|
-
outputSchema: CapabilitiesOutputSchema,
|
|
54
44
|
annotations: {
|
|
55
45
|
readOnlyHint: false,
|
|
56
46
|
destructiveHint: false,
|
|
@@ -64,10 +54,7 @@ export function registerCapabilityTools(mcp: McpServer, client: AgledgerClient):
|
|
|
64
54
|
const result = await client.capabilities.set(args.agentId, {
|
|
65
55
|
contractTypes: args.contractTypes,
|
|
66
56
|
});
|
|
67
|
-
return {
|
|
68
|
-
content: [{ type: 'text', text: `Capabilities declared for ${result.agentId}: ${result.capabilities.join(', ')}.` }],
|
|
69
|
-
structuredContent: toStructuredContent(result),
|
|
70
|
-
};
|
|
57
|
+
return { content: [], structuredContent: toStructuredContent(result) };
|
|
71
58
|
} catch (err) {
|
|
72
59
|
return apiErrorResult(err);
|
|
73
60
|
}
|
package/src/tools/compliance.ts
CHANGED
|
@@ -16,13 +16,6 @@ export function registerComplianceTools(mcp: McpServer, client: AgledgerClient):
|
|
|
16
16
|
attestation: z.record(z.string(), z.unknown()).describe('Attestation data'),
|
|
17
17
|
attestedBy: z.string().describe('Who attested (name or ID)'),
|
|
18
18
|
},
|
|
19
|
-
outputSchema: z.object({
|
|
20
|
-
id: z.string().describe('Compliance record ID'),
|
|
21
|
-
mandateId: z.string().describe('Associated mandate ID'),
|
|
22
|
-
recordType: z.string().describe('Record type'),
|
|
23
|
-
attestedBy: z.string().describe('Who attested'),
|
|
24
|
-
createdAt: z.string().nullable().optional().describe('ISO 8601 creation timestamp'),
|
|
25
|
-
}).passthrough().describe('Created compliance attestation record'),
|
|
26
19
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
27
20
|
_meta: toolMeta('create_compliance_record'),
|
|
28
21
|
},
|
|
@@ -33,10 +26,7 @@ export function registerComplianceTools(mcp: McpServer, client: AgledgerClient):
|
|
|
33
26
|
attestation: args.attestation,
|
|
34
27
|
attestedBy: args.attestedBy,
|
|
35
28
|
});
|
|
36
|
-
return {
|
|
37
|
-
content: [{ type: 'text', text: `Compliance record created for mandate ${args.mandateId} (type: ${args.recordType}).` }],
|
|
38
|
-
structuredContent: toStructuredContent(record),
|
|
39
|
-
};
|
|
29
|
+
return { content: [], structuredContent: toStructuredContent(record) };
|
|
40
30
|
} catch (err) { return apiErrorResult(err); }
|
|
41
31
|
},
|
|
42
32
|
);
|
|
@@ -50,26 +40,13 @@ export function registerComplianceTools(mcp: McpServer, client: AgledgerClient):
|
|
|
50
40
|
mandateId: z.string().describe('Mandate ID'),
|
|
51
41
|
limit: z.number().optional().describe('Page size'),
|
|
52
42
|
},
|
|
53
|
-
outputSchema: z.object({
|
|
54
|
-
data: z.array(z.object({
|
|
55
|
-
id: z.string().optional().describe('Compliance record ID'),
|
|
56
|
-
mandateId: z.string().optional().describe('Associated mandate ID'),
|
|
57
|
-
recordType: z.string().optional().describe('Record type'),
|
|
58
|
-
attestedBy: z.string().optional().describe('Who attested'),
|
|
59
|
-
createdAt: z.string().nullable().optional().describe('ISO 8601 creation timestamp'),
|
|
60
|
-
}).passthrough()).describe('Array of compliance records'),
|
|
61
|
-
total: z.number().nullable().optional().describe('Total count'),
|
|
62
|
-
}).passthrough().describe('Paginated list of compliance records for a mandate'),
|
|
63
43
|
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
64
44
|
_meta: toolMeta('list_compliance_records'),
|
|
65
45
|
},
|
|
66
46
|
async (args) => {
|
|
67
47
|
try {
|
|
68
48
|
const result = await client.compliance.listRecords(args.mandateId, { limit: args.limit });
|
|
69
|
-
return {
|
|
70
|
-
content: [{ type: 'text', text: `Found ${result.data.length} compliance records for mandate ${args.mandateId}.` }],
|
|
71
|
-
structuredContent: toStructuredContent(result),
|
|
72
|
-
};
|
|
49
|
+
return { content: [], structuredContent: toStructuredContent(result) };
|
|
73
50
|
} catch (err) { return apiErrorResult(err); }
|
|
74
51
|
},
|
|
75
52
|
);
|
|
@@ -80,24 +57,13 @@ export function registerComplianceTools(mcp: McpServer, client: AgledgerClient):
|
|
|
80
57
|
title: 'EU AI Act Report',
|
|
81
58
|
description: 'Get EU AI Act compliance report showing risk classifications, human oversight designations, and audit status across all mandates.',
|
|
82
59
|
inputSchema: {},
|
|
83
|
-
outputSchema: z.object({
|
|
84
|
-
summary: z.object({
|
|
85
|
-
highRiskCount: z.number().describe('Count of high-risk mandates'),
|
|
86
|
-
auditedCount: z.number().describe('Count of audited mandates'),
|
|
87
|
-
totalCount: z.number().nullable().optional().describe('Total mandate count'),
|
|
88
|
-
}).passthrough().describe('Report summary counts'),
|
|
89
|
-
mandates: z.array(z.record(z.string(), z.unknown())).nullable().optional().describe('Detailed mandate-level compliance data'),
|
|
90
|
-
}).passthrough().describe('EU AI Act compliance report'),
|
|
91
60
|
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
92
61
|
_meta: toolMeta('get_eu_ai_act_report'),
|
|
93
62
|
},
|
|
94
63
|
async () => {
|
|
95
64
|
try {
|
|
96
65
|
const report = await client.compliance.getEuAiActReport();
|
|
97
|
-
return {
|
|
98
|
-
content: [{ type: 'text', text: `EU AI Act report: ${report.summary.highRiskCount} high-risk mandates, ${report.summary.auditedCount} audited.` }],
|
|
99
|
-
structuredContent: toStructuredContent(report),
|
|
100
|
-
};
|
|
66
|
+
return { content: [], structuredContent: toStructuredContent(report) };
|
|
101
67
|
} catch (err) { return apiErrorResult(err); }
|
|
102
68
|
},
|
|
103
69
|
);
|
package/src/tools/dashboard.ts
CHANGED
|
@@ -11,23 +11,13 @@ export function registerDashboardTools(mcp: McpServer, client: AgledgerClient):
|
|
|
11
11
|
title: 'Dashboard Summary',
|
|
12
12
|
description: 'Get a high-level dashboard summary: mandate counts, active agents, fulfillment rates, settlement signals. Start here for situational awareness.',
|
|
13
13
|
inputSchema: {},
|
|
14
|
-
outputSchema: z.object({
|
|
15
|
-
totalMandates: z.number().describe('Total number of mandates'),
|
|
16
|
-
activeCount: z.number().describe('Count of active mandates'),
|
|
17
|
-
fulfilledCount: z.number().describe('Count of fulfilled mandates'),
|
|
18
|
-
failedCount: z.number().nullable().optional().describe('Count of failed mandates'),
|
|
19
|
-
disputeCount: z.number().nullable().optional().describe('Count of open disputes'),
|
|
20
|
-
}).passthrough().describe('High-level dashboard summary with mandate counts and rates'),
|
|
21
14
|
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
22
15
|
_meta: toolMeta('get_dashboard_summary'),
|
|
23
16
|
},
|
|
24
17
|
async () => {
|
|
25
18
|
try {
|
|
26
19
|
const summary = await client.dashboard.getSummary();
|
|
27
|
-
return {
|
|
28
|
-
content: [{ type: 'text', text: `Dashboard: ${summary.totalMandates} mandates, ${summary.activeCount} active, ${summary.fulfilledCount} fulfilled.` }],
|
|
29
|
-
structuredContent: toStructuredContent(summary),
|
|
30
|
-
};
|
|
20
|
+
return { content: [], structuredContent: toStructuredContent(summary) };
|
|
31
21
|
} catch (err) { return apiErrorResult(err); }
|
|
32
22
|
},
|
|
33
23
|
);
|
|
@@ -42,24 +32,13 @@ export function registerDashboardTools(mcp: McpServer, client: AgledgerClient):
|
|
|
42
32
|
to: z.string().optional().describe('End date (ISO 8601)'),
|
|
43
33
|
granularity: z.enum(['daily', 'weekly', 'monthly']).optional().describe('Time bucket size'),
|
|
44
34
|
},
|
|
45
|
-
outputSchema: z.object({
|
|
46
|
-
series: z.array(z.object({
|
|
47
|
-
date: z.string().describe('ISO 8601 date for this data point'),
|
|
48
|
-
mandates: z.number().nullable().optional().describe('Mandate count for this period'),
|
|
49
|
-
receipts: z.number().nullable().optional().describe('Receipt count for this period'),
|
|
50
|
-
disputes: z.number().nullable().optional().describe('Dispute count for this period'),
|
|
51
|
-
}).passthrough()).nullable().optional().describe('Time-series data points'),
|
|
52
|
-
}).passthrough().describe('Dashboard time-series metrics'),
|
|
53
35
|
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
54
36
|
_meta: toolMeta('get_dashboard_metrics'),
|
|
55
37
|
},
|
|
56
38
|
async (args) => {
|
|
57
39
|
try {
|
|
58
40
|
const metrics = await client.dashboard.getMetrics(args);
|
|
59
|
-
return {
|
|
60
|
-
content: [{ type: 'text', text: `Metrics: ${metrics.series?.length ?? 0} data points.` }],
|
|
61
|
-
structuredContent: toStructuredContent(metrics),
|
|
62
|
-
};
|
|
41
|
+
return { content: [], structuredContent: toStructuredContent(metrics) };
|
|
63
42
|
} catch (err) { return apiErrorResult(err); }
|
|
64
43
|
},
|
|
65
44
|
);
|
|
@@ -72,26 +51,13 @@ export function registerDashboardTools(mcp: McpServer, client: AgledgerClient):
|
|
|
72
51
|
inputSchema: {
|
|
73
52
|
limit: z.number().optional().describe('Page size'),
|
|
74
53
|
},
|
|
75
|
-
outputSchema: z.object({
|
|
76
|
-
data: z.array(z.object({
|
|
77
|
-
id: z.string().optional().describe('Alert ID'),
|
|
78
|
-
type: z.string().optional().describe('Alert type (e.g. overdue, failed_verification)'),
|
|
79
|
-
message: z.string().optional().describe('Human-readable alert message'),
|
|
80
|
-
severity: z.string().nullable().optional().describe('Alert severity level'),
|
|
81
|
-
createdAt: z.string().nullable().optional().describe('ISO 8601 creation timestamp'),
|
|
82
|
-
}).passthrough()).describe('Array of active alerts'),
|
|
83
|
-
total: z.number().nullable().optional().describe('Total count of alerts'),
|
|
84
|
-
}).passthrough().describe('Dashboard alerts requiring attention'),
|
|
85
54
|
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
86
55
|
_meta: toolMeta('get_dashboard_alerts'),
|
|
87
56
|
},
|
|
88
57
|
async (args) => {
|
|
89
58
|
try {
|
|
90
59
|
const result = await client.dashboard.getAlerts(args);
|
|
91
|
-
return {
|
|
92
|
-
content: [{ type: 'text', text: `Found ${result.data.length} alerts.` }],
|
|
93
|
-
structuredContent: toStructuredContent(result),
|
|
94
|
-
};
|
|
60
|
+
return { content: [], structuredContent: toStructuredContent(result) };
|
|
95
61
|
} catch (err) { return apiErrorResult(err); }
|
|
96
62
|
},
|
|
97
63
|
);
|