@tonyclaw/agent-inspector 2.0.33 → 2.0.35
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/.output/cli.js +19 -1
- package/.output/nitro.json +1 -1
- package/.output/public/assets/{CompareDrawer-ClTJxdoU.js → CompareDrawer-Cin0_f71.js} +1 -1
- package/.output/public/assets/{ProxyViewerContainer--Pes01q2.js → ProxyViewerContainer-BVlcRirf.js} +9 -9
- package/.output/public/assets/{ReplayDialog-iuzfh85b.js → ReplayDialog-C6nOMhjx.js} +1 -1
- package/.output/public/assets/{RequestAnatomy-FZnnP9Gx.js → RequestAnatomy-DenWbdqV.js} +1 -1
- package/.output/public/assets/{ResponseView-MZ6ZWvbL.js → ResponseView-BsalZiZ5.js} +1 -1
- package/.output/public/assets/{StreamingChunkSequence-B8mZMdzs.js → StreamingChunkSequence-Cla2X13P.js} +1 -1
- package/.output/public/assets/_sessionId-DkhHqlzB.js +1 -0
- package/.output/public/assets/index-AiQY20d7.js +1 -0
- package/.output/public/assets/index-BfGJEb-2.css +1 -0
- package/.output/public/assets/{main-B797Hnge.js → main-eD8hEOHT.js} +2 -2
- package/.output/server/_libs/ajv.mjs +827 -6191
- package/.output/server/_libs/cookie-es.mjs +7 -21
- package/.output/server/_libs/h3-v2.mjs +18 -7
- package/.output/server/_libs/json-schema-traverse.mjs +1 -90
- package/.output/server/_libs/seroval-plugins.mjs +5 -5
- package/.output/server/_libs/seroval.mjs +606 -596
- package/.output/server/_libs/srvx.mjs +10 -5
- package/.output/server/_libs/tanstack__history.mjs +55 -38
- package/.output/server/_libs/tanstack__router-core.mjs +4366 -4075
- package/.output/server/{_sessionId-DD05qd8d.mjs → _sessionId-URSu2XsA.mjs} +4 -4
- package/.output/server/_ssr/{CompareDrawer-oGOG5-kQ.mjs → CompareDrawer-BbBPKdVc.mjs} +4 -4
- package/.output/server/_ssr/{ProxyViewerContainer-Bbl5tqT1.mjs → ProxyViewerContainer-DtQxtOpi.mjs} +15 -7
- package/.output/server/_ssr/{ReplayDialog-BegfwWIy.mjs → ReplayDialog-BU20cMGd.mjs} +5 -5
- package/.output/server/_ssr/{RequestAnatomy-BW_X2DyZ.mjs → RequestAnatomy-a5ySAAG1.mjs} +4 -4
- package/.output/server/_ssr/{ResponseView-Bx_uJ4RS.mjs → ResponseView-CA_QM1fM.mjs} +4 -4
- package/.output/server/_ssr/{StreamingChunkSequence-CQp5QQnB.mjs → StreamingChunkSequence-DJjITqM7.mjs} +4 -4
- package/.output/server/_ssr/{index-ODSKeDD8.mjs → index-DIFzLUAV.mjs} +4 -4
- package/.output/server/_ssr/index.mjs +20 -11
- package/.output/server/_ssr/{router-QcI4GOvo.mjs → router-aVeuM_1d.mjs} +5193 -5269
- package/.output/server/{_tanstack-start-manifest_v-dEujKJ3-.mjs → _tanstack-start-manifest_v-BNlafGbl.mjs} +1 -1
- package/.output/server/index.mjs +65 -65
- package/README.md +28 -0
- package/package.json +6 -2
- package/src/cli/templates/codex-skill-onboard.ts +19 -1
- package/src/components/providers/SettingsDialog.tsx +10 -0
- package/src/lib/groupContract.ts +0 -2
- package/src/lib/runContract.ts +0 -3
- package/src/mcp/server.ts +101 -164
- package/src/mcp/toolHandlers.ts +80 -177
- package/src/routes/api/groups.$groupId.evidence.ts +14 -33
- package/src/routes/api/groups.$groupId.sessions.ts +9 -9
- package/src/routes/api/groups.$groupId.ts +19 -13
- package/src/routes/api/groups.ts +3 -3
- package/src/routes/api/runs.$runId.evidence.ts +14 -21
- package/src/routes/api/runs.$runId.ts +9 -9
- package/src/routes/api/runs.ts +9 -5
- package/src/services/groups.ts +110 -0
- package/src/services/result.ts +17 -0
- package/src/services/runs.ts +76 -0
- package/.output/public/assets/_sessionId-Bc26Rfxs.js +0 -1
- package/.output/public/assets/index-C6AiRPsJ.js +0 -1
- package/.output/public/assets/index-C_8PFAm2.css +0 -1
package/src/mcp/server.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MCP (Model Context Protocol) server for agent-inspector.
|
|
3
3
|
*
|
|
4
|
-
* Exposes `inspector_*` tools
|
|
5
|
-
* via internal HTTP loopback (see `loopback.ts` for the rationale). Mounted
|
|
4
|
+
* Exposes `inspector_*` tools and resources. Mounted
|
|
6
5
|
* at `POST /api/mcp` in the existing TanStack Start process using HTTP Streamable
|
|
7
6
|
* transport. localhost-only, no auth in v1 — see
|
|
8
7
|
* `openspec/changes/add-mcp-server/design.md` decisions D1, D2, D9.
|
|
@@ -11,8 +10,8 @@
|
|
|
11
10
|
* instantiated once per process on first request and reused for all
|
|
12
11
|
* subsequent requests (stateless mode — no `sessionIdGenerator`).
|
|
13
12
|
*
|
|
14
|
-
* Tool implementations live in `./toolHandlers.ts
|
|
15
|
-
*
|
|
13
|
+
* Tool implementations live in `./toolHandlers.ts`; this file wires them to
|
|
14
|
+
* the SDK and exposes MCP resources/prompts.
|
|
16
15
|
*/
|
|
17
16
|
|
|
18
17
|
import { z } from "zod";
|
|
@@ -30,18 +29,24 @@ import {
|
|
|
30
29
|
AddInspectorGroupSessionInputSchema,
|
|
31
30
|
DeleteInspectorGroupOptionsSchema,
|
|
32
31
|
GroupEvidenceExportOptionsSchema,
|
|
33
|
-
InspectorGroupSchema,
|
|
34
32
|
InspectorGroupStatusSchema,
|
|
35
|
-
InspectorGroupsListResponseSchema,
|
|
36
33
|
UpdateInspectorGroupInputSchema,
|
|
37
34
|
} from "../lib/groupContract";
|
|
38
|
-
import {
|
|
39
|
-
InspectorRunSchema,
|
|
40
|
-
InspectorRunStatusSchema,
|
|
41
|
-
UpdateInspectorRunInputSchema,
|
|
42
|
-
} from "../lib/runContract";
|
|
35
|
+
import { InspectorRunStatusSchema, UpdateInspectorRunInputSchema } from "../lib/runContract";
|
|
43
36
|
import { setCurrentPort } from "../lib/serverPort";
|
|
44
37
|
import { JsonValueSchema } from "../proxy/schemas";
|
|
38
|
+
import {
|
|
39
|
+
getInspectorGroup,
|
|
40
|
+
listInspectorGroups,
|
|
41
|
+
readInspectorGroupEvidence,
|
|
42
|
+
readInspectorGroupSessions,
|
|
43
|
+
} from "../services/groups";
|
|
44
|
+
import {
|
|
45
|
+
getInspectorRun,
|
|
46
|
+
listInspectorRecentFailures,
|
|
47
|
+
listInspectorRuns,
|
|
48
|
+
readInspectorRunEvidence,
|
|
49
|
+
} from "../services/runs";
|
|
45
50
|
import { callApi } from "./loopback";
|
|
46
51
|
import {
|
|
47
52
|
addGroupSessionImpl,
|
|
@@ -179,22 +184,10 @@ Either preview field is null when the body is unknown format, unparseable, or th
|
|
|
179
184
|
const PROVIDER_WRITE_WARNING =
|
|
180
185
|
"⚠ This tool mutates provider configuration. Confirm with the user before invoking.";
|
|
181
186
|
|
|
182
|
-
const RunsListResponseSchema = z.object({
|
|
183
|
-
runs: z.array(InspectorRunSchema),
|
|
184
|
-
});
|
|
185
|
-
|
|
186
187
|
const LogResourceListResponseSchema = z.object({
|
|
187
188
|
logs: z.array(z.object({ id: z.number().int().positive() })),
|
|
188
189
|
});
|
|
189
190
|
|
|
190
|
-
const EvidenceReadResponseSchema = z.object({
|
|
191
|
-
markdown: z.string(),
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
const GroupEvidenceReadResponseSchema = z.object({
|
|
195
|
-
markdown: z.string(),
|
|
196
|
-
});
|
|
197
|
-
|
|
198
191
|
type ResourceDescriptor = {
|
|
199
192
|
uri: string;
|
|
200
193
|
name: string;
|
|
@@ -236,6 +229,14 @@ async function readApiJsonResource(uri: URL, path: string): Promise<ReadResource
|
|
|
236
229
|
}
|
|
237
230
|
}
|
|
238
231
|
|
|
232
|
+
function readServiceJsonResource<T>(
|
|
233
|
+
uri: URL,
|
|
234
|
+
result: { ok: true; value: T } | { ok: false; message: string },
|
|
235
|
+
): ReadResourceResult {
|
|
236
|
+
if (!result.ok) return textResource(uri, "text/plain", result.message);
|
|
237
|
+
return jsonResource(uri, result.value);
|
|
238
|
+
}
|
|
239
|
+
|
|
239
240
|
async function listSessionResources(): Promise<ListResourcesResult> {
|
|
240
241
|
try {
|
|
241
242
|
const response = await callApi("/api/sessions");
|
|
@@ -274,105 +275,65 @@ async function listLogResources(): Promise<ListResourcesResult> {
|
|
|
274
275
|
}
|
|
275
276
|
}
|
|
276
277
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
name: `run:${run.id}`,
|
|
287
|
-
title: run.title,
|
|
288
|
-
mimeType: "application/json",
|
|
289
|
-
})),
|
|
290
|
-
);
|
|
291
|
-
} catch {
|
|
292
|
-
return listResult([]);
|
|
293
|
-
}
|
|
278
|
+
function listRunResources(): ListResourcesResult {
|
|
279
|
+
return listResult(
|
|
280
|
+
listInspectorRuns().runs.map((run) => ({
|
|
281
|
+
uri: `inspector://runs/${encodeURIComponent(run.id)}`,
|
|
282
|
+
name: `run:${run.id}`,
|
|
283
|
+
title: run.title,
|
|
284
|
+
mimeType: "application/json",
|
|
285
|
+
})),
|
|
286
|
+
);
|
|
294
287
|
}
|
|
295
288
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
name: `group:${group.id}`,
|
|
306
|
-
title: group.title,
|
|
307
|
-
mimeType: "application/json",
|
|
308
|
-
})),
|
|
309
|
-
);
|
|
310
|
-
} catch {
|
|
311
|
-
return listResult([]);
|
|
312
|
-
}
|
|
289
|
+
function listGroupResources(): ListResourcesResult {
|
|
290
|
+
return listResult(
|
|
291
|
+
listInspectorGroups().groups.map((group) => ({
|
|
292
|
+
uri: `inspector://groups/${encodeURIComponent(group.id)}`,
|
|
293
|
+
name: `group:${group.id}`,
|
|
294
|
+
title: group.title,
|
|
295
|
+
mimeType: "application/json",
|
|
296
|
+
})),
|
|
297
|
+
);
|
|
313
298
|
}
|
|
314
299
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
name: `group-sessions:${group.id}`,
|
|
325
|
-
title: `${group.title} sessions`,
|
|
326
|
-
mimeType: "application/json",
|
|
327
|
-
})),
|
|
328
|
-
);
|
|
329
|
-
} catch {
|
|
330
|
-
return listResult([]);
|
|
331
|
-
}
|
|
300
|
+
function listGroupSessionResources(): ListResourcesResult {
|
|
301
|
+
return listResult(
|
|
302
|
+
listInspectorGroups().groups.map((group) => ({
|
|
303
|
+
uri: `inspector://groups/${encodeURIComponent(group.id)}/sessions`,
|
|
304
|
+
name: `group-sessions:${group.id}`,
|
|
305
|
+
title: `${group.title} sessions`,
|
|
306
|
+
mimeType: "application/json",
|
|
307
|
+
})),
|
|
308
|
+
);
|
|
332
309
|
}
|
|
333
310
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
.
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
title: `${group.title} evidence pack`,
|
|
347
|
-
mimeType: "text/markdown",
|
|
348
|
-
description: group.evidence?.markdownPath,
|
|
349
|
-
})),
|
|
350
|
-
);
|
|
351
|
-
} catch {
|
|
352
|
-
return listResult([]);
|
|
353
|
-
}
|
|
311
|
+
function listGroupEvidenceResources(): ListResourcesResult {
|
|
312
|
+
return listResult(
|
|
313
|
+
listInspectorGroups()
|
|
314
|
+
.groups.filter((group) => group.evidence !== null)
|
|
315
|
+
.map((group) => ({
|
|
316
|
+
uri: `inspector://groups/${encodeURIComponent(group.id)}/evidence`,
|
|
317
|
+
name: `group-evidence:${group.id}`,
|
|
318
|
+
title: `${group.title} evidence pack`,
|
|
319
|
+
mimeType: "text/markdown",
|
|
320
|
+
description: group.evidence?.markdownPath,
|
|
321
|
+
})),
|
|
322
|
+
);
|
|
354
323
|
}
|
|
355
324
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
.
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
title: `${run.title} evidence pack`,
|
|
369
|
-
mimeType: "text/markdown",
|
|
370
|
-
description: run.evidence?.markdownPath,
|
|
371
|
-
})),
|
|
372
|
-
);
|
|
373
|
-
} catch {
|
|
374
|
-
return listResult([]);
|
|
375
|
-
}
|
|
325
|
+
function listEvidenceResources(): ListResourcesResult {
|
|
326
|
+
return listResult(
|
|
327
|
+
listInspectorRuns()
|
|
328
|
+
.runs.filter((run) => run.evidence !== null)
|
|
329
|
+
.map((run) => ({
|
|
330
|
+
uri: `inspector://evidence/${encodeURIComponent(run.id)}`,
|
|
331
|
+
name: `evidence:${run.id}`,
|
|
332
|
+
title: `${run.title} evidence pack`,
|
|
333
|
+
mimeType: "text/markdown",
|
|
334
|
+
description: run.evidence?.markdownPath,
|
|
335
|
+
})),
|
|
336
|
+
);
|
|
376
337
|
}
|
|
377
338
|
|
|
378
339
|
function userPrompt(text: string): GetPromptResult {
|
|
@@ -531,7 +492,7 @@ function registerTools(server: McpServer): void {
|
|
|
531
492
|
metadata: z.record(z.string(), JsonValueSchema).optional().describe("JSON metadata."),
|
|
532
493
|
}),
|
|
533
494
|
},
|
|
534
|
-
(args) => safeCall(() => createRunImpl(
|
|
495
|
+
(args) => safeCall(() => createRunImpl(args)),
|
|
535
496
|
);
|
|
536
497
|
|
|
537
498
|
server.registerTool(
|
|
@@ -544,7 +505,7 @@ function registerTools(server: McpServer): void {
|
|
|
544
505
|
runId: z.string().min(1).describe("The Inspector run id."),
|
|
545
506
|
}),
|
|
546
507
|
},
|
|
547
|
-
(args) => safeCall(() => getRunImpl(
|
|
508
|
+
(args) => safeCall(() => getRunImpl(args)),
|
|
548
509
|
);
|
|
549
510
|
|
|
550
511
|
server.registerTool(
|
|
@@ -557,7 +518,7 @@ function registerTools(server: McpServer): void {
|
|
|
557
518
|
runId: z.string().min(1).describe("The Inspector run id."),
|
|
558
519
|
}),
|
|
559
520
|
},
|
|
560
|
-
(args) => safeCall(() => updateRunImpl(
|
|
521
|
+
(args) => safeCall(() => updateRunImpl(args)),
|
|
561
522
|
);
|
|
562
523
|
|
|
563
524
|
server.registerTool(
|
|
@@ -581,7 +542,7 @@ function registerTools(server: McpServer): void {
|
|
|
581
542
|
.describe("How many compact log summaries to include in the evidence pack. Max 50."),
|
|
582
543
|
}),
|
|
583
544
|
},
|
|
584
|
-
(args) => safeCall(() => exportEvidenceImpl(
|
|
545
|
+
(args) => safeCall(() => exportEvidenceImpl(args)),
|
|
585
546
|
);
|
|
586
547
|
|
|
587
548
|
server.registerTool(
|
|
@@ -600,7 +561,7 @@ function registerTools(server: McpServer): void {
|
|
|
600
561
|
.describe("Maximum failures to return. Default 5, max 20."),
|
|
601
562
|
}),
|
|
602
563
|
},
|
|
603
|
-
(args) => safeCall(() => getRecentFailuresImpl(
|
|
564
|
+
(args) => safeCall(() => getRecentFailuresImpl(args)),
|
|
604
565
|
);
|
|
605
566
|
|
|
606
567
|
server.registerTool(
|
|
@@ -611,7 +572,7 @@ function registerTools(server: McpServer): void {
|
|
|
611
572
|
"Lists declared Inspector groups. Groups aggregate multiple sessions/runs, commonly one evaluation matrix spanning several providers or models.",
|
|
612
573
|
inputSchema: z.object({}),
|
|
613
574
|
},
|
|
614
|
-
() => safeCall(() => listGroupsImpl(
|
|
575
|
+
() => safeCall(() => listGroupsImpl()),
|
|
615
576
|
);
|
|
616
577
|
|
|
617
578
|
server.registerTool(
|
|
@@ -634,7 +595,7 @@ function registerTools(server: McpServer): void {
|
|
|
634
595
|
metadata: z.record(z.string(), JsonValueSchema).optional().describe("JSON metadata."),
|
|
635
596
|
}),
|
|
636
597
|
},
|
|
637
|
-
(args) => safeCall(() => createGroupImpl(
|
|
598
|
+
(args) => safeCall(() => createGroupImpl(args)),
|
|
638
599
|
);
|
|
639
600
|
|
|
640
601
|
server.registerTool(
|
|
@@ -647,7 +608,7 @@ function registerTools(server: McpServer): void {
|
|
|
647
608
|
groupId: z.string().min(1).describe("The Inspector group id."),
|
|
648
609
|
}),
|
|
649
610
|
},
|
|
650
|
-
(args) => safeCall(() => getGroupImpl(
|
|
611
|
+
(args) => safeCall(() => getGroupImpl(args)),
|
|
651
612
|
);
|
|
652
613
|
|
|
653
614
|
server.registerTool(
|
|
@@ -660,7 +621,7 @@ function registerTools(server: McpServer): void {
|
|
|
660
621
|
groupId: z.string().min(1).describe("The Inspector group id."),
|
|
661
622
|
}),
|
|
662
623
|
},
|
|
663
|
-
(args) => safeCall(() => updateGroupImpl(
|
|
624
|
+
(args) => safeCall(() => updateGroupImpl(args)),
|
|
664
625
|
);
|
|
665
626
|
|
|
666
627
|
server.registerTool(
|
|
@@ -673,7 +634,7 @@ function registerTools(server: McpServer): void {
|
|
|
673
634
|
groupId: z.string().min(1).describe("The Inspector group id."),
|
|
674
635
|
}),
|
|
675
636
|
},
|
|
676
|
-
(args) => safeCall(() => deleteGroupImpl(
|
|
637
|
+
(args) => safeCall(() => deleteGroupImpl(args)),
|
|
677
638
|
);
|
|
678
639
|
|
|
679
640
|
server.registerTool(
|
|
@@ -686,7 +647,7 @@ function registerTools(server: McpServer): void {
|
|
|
686
647
|
groupId: z.string().min(1).describe("The Inspector group id."),
|
|
687
648
|
}),
|
|
688
649
|
},
|
|
689
|
-
(args) => safeCall(() => addGroupSessionImpl(
|
|
650
|
+
(args) => safeCall(() => addGroupSessionImpl(args)),
|
|
690
651
|
);
|
|
691
652
|
|
|
692
653
|
server.registerTool(
|
|
@@ -699,7 +660,7 @@ function registerTools(server: McpServer): void {
|
|
|
699
660
|
groupId: z.string().min(1).describe("The Inspector group id."),
|
|
700
661
|
}),
|
|
701
662
|
},
|
|
702
|
-
(args) => safeCall(() => exportGroupEvidenceImpl(
|
|
663
|
+
(args) => safeCall(() => exportGroupEvidenceImpl(args)),
|
|
703
664
|
);
|
|
704
665
|
|
|
705
666
|
server.registerTool(
|
|
@@ -942,7 +903,7 @@ function registerResources(server: McpServer): void {
|
|
|
942
903
|
description: "Declared Inspector evaluation runs.",
|
|
943
904
|
mimeType: "application/json",
|
|
944
905
|
},
|
|
945
|
-
(uri) =>
|
|
906
|
+
(uri) => jsonResource(uri, listInspectorRuns()),
|
|
946
907
|
);
|
|
947
908
|
|
|
948
909
|
server.registerResource(
|
|
@@ -953,7 +914,7 @@ function registerResources(server: McpServer): void {
|
|
|
953
914
|
description: "Declared Inspector groups aggregating multiple sessions or runs.",
|
|
954
915
|
mimeType: "application/json",
|
|
955
916
|
},
|
|
956
|
-
(uri) =>
|
|
917
|
+
(uri) => jsonResource(uri, listInspectorGroups()),
|
|
957
918
|
);
|
|
958
919
|
|
|
959
920
|
server.registerResource(
|
|
@@ -967,7 +928,7 @@ function registerResources(server: McpServer): void {
|
|
|
967
928
|
(uri, variables) => {
|
|
968
929
|
const groupId = variableString(variables, "groupId");
|
|
969
930
|
if (groupId === null) return textResource(uri, "text/plain", "Missing groupId");
|
|
970
|
-
return
|
|
931
|
+
return readServiceJsonResource(uri, getInspectorGroup(groupId));
|
|
971
932
|
},
|
|
972
933
|
);
|
|
973
934
|
|
|
@@ -984,7 +945,7 @@ function registerResources(server: McpServer): void {
|
|
|
984
945
|
(uri, variables) => {
|
|
985
946
|
const groupId = variableString(variables, "groupId");
|
|
986
947
|
if (groupId === null) return textResource(uri, "text/plain", "Missing groupId");
|
|
987
|
-
return
|
|
948
|
+
return readServiceJsonResource(uri, readInspectorGroupSessions(groupId));
|
|
988
949
|
},
|
|
989
950
|
);
|
|
990
951
|
|
|
@@ -997,7 +958,7 @@ function registerResources(server: McpServer): void {
|
|
|
997
958
|
"Recent declared runs with failed/cancelled status or non-success exported evidence.",
|
|
998
959
|
mimeType: "application/json",
|
|
999
960
|
},
|
|
1000
|
-
(uri) =>
|
|
961
|
+
(uri) => jsonResource(uri, listInspectorRecentFailures(10)),
|
|
1001
962
|
);
|
|
1002
963
|
|
|
1003
964
|
server.registerResource(
|
|
@@ -1011,7 +972,7 @@ function registerResources(server: McpServer): void {
|
|
|
1011
972
|
(uri, variables) => {
|
|
1012
973
|
const runId = variableString(variables, "runId");
|
|
1013
974
|
if (runId === null) return textResource(uri, "text/plain", "Missing runId");
|
|
1014
|
-
return
|
|
975
|
+
return readServiceJsonResource(uri, getInspectorRun(runId));
|
|
1015
976
|
},
|
|
1016
977
|
);
|
|
1017
978
|
|
|
@@ -1024,24 +985,12 @@ function registerResources(server: McpServer): void {
|
|
|
1024
985
|
"Markdown evidence pack for a declared Inspector run. Generate it first with inspector_export_evidence.",
|
|
1025
986
|
mimeType: "text/markdown",
|
|
1026
987
|
},
|
|
1027
|
-
|
|
988
|
+
(uri, variables) => {
|
|
1028
989
|
const runId = variableString(variables, "runId");
|
|
1029
990
|
if (runId === null) return textResource(uri, "text/plain", "Missing runId");
|
|
1030
|
-
const
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
if (!response.ok) {
|
|
1034
|
-
return textResource(uri, "text/plain", `GET ${path} returned ${response.status}`);
|
|
1035
|
-
}
|
|
1036
|
-
const parsed = EvidenceReadResponseSchema.safeParse(await response.json());
|
|
1037
|
-
if (!parsed.success) {
|
|
1038
|
-
return textResource(uri, "text/plain", "Evidence endpoint returned an unparseable body");
|
|
1039
|
-
}
|
|
1040
|
-
return textResource(uri, "text/markdown", parsed.data.markdown);
|
|
1041
|
-
} catch (err) {
|
|
1042
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
1043
|
-
return textResource(uri, "text/plain", `Resource read failed: ${message}`);
|
|
1044
|
-
}
|
|
991
|
+
const evidence = readInspectorRunEvidence(runId);
|
|
992
|
+
if (!evidence.ok) return textResource(uri, "text/plain", evidence.message);
|
|
993
|
+
return textResource(uri, "text/markdown", evidence.value.markdown);
|
|
1045
994
|
},
|
|
1046
995
|
);
|
|
1047
996
|
|
|
@@ -1056,24 +1005,12 @@ function registerResources(server: McpServer): void {
|
|
|
1056
1005
|
"Markdown evidence pack for an Inspector group. Generate it first with inspector_export_group_evidence.",
|
|
1057
1006
|
mimeType: "text/markdown",
|
|
1058
1007
|
},
|
|
1059
|
-
|
|
1008
|
+
(uri, variables) => {
|
|
1060
1009
|
const groupId = variableString(variables, "groupId");
|
|
1061
1010
|
if (groupId === null) return textResource(uri, "text/plain", "Missing groupId");
|
|
1062
|
-
const
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
if (!response.ok) {
|
|
1066
|
-
return textResource(uri, "text/plain", `GET ${path} returned ${response.status}`);
|
|
1067
|
-
}
|
|
1068
|
-
const parsed = GroupEvidenceReadResponseSchema.safeParse(await response.json());
|
|
1069
|
-
if (!parsed.success) {
|
|
1070
|
-
return textResource(uri, "text/plain", "Evidence endpoint returned an unparseable body");
|
|
1071
|
-
}
|
|
1072
|
-
return textResource(uri, "text/markdown", parsed.data.markdown);
|
|
1073
|
-
} catch (err) {
|
|
1074
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
1075
|
-
return textResource(uri, "text/plain", `Resource read failed: ${message}`);
|
|
1076
|
-
}
|
|
1011
|
+
const evidence = readInspectorGroupEvidence(groupId);
|
|
1012
|
+
if (!evidence.ok) return textResource(uri, "text/plain", evidence.message);
|
|
1013
|
+
return textResource(uri, "text/markdown", evidence.value.markdown);
|
|
1077
1014
|
},
|
|
1078
1015
|
);
|
|
1079
1016
|
}
|