@inspectr/mcplab 0.1.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 (136) hide show
  1. package/README.md +762 -0
  2. package/dist/app/android-chrome-192x192.png +0 -0
  3. package/dist/app/android-chrome-512x512.png +0 -0
  4. package/dist/app/apple-touch-icon.png +0 -0
  5. package/dist/app/assets/index-DT-Z4AVG.js +249 -0
  6. package/dist/app/assets/index-EP4WAY8u.css +1 -0
  7. package/dist/app/favicon-16x16.png +0 -0
  8. package/dist/app/favicon-32x32.png +0 -0
  9. package/dist/app/favicon.svg +13 -0
  10. package/dist/app/index.html +26 -0
  11. package/dist/app/inspectr_logo_color.svg +9 -0
  12. package/dist/app/mcp.png +0 -0
  13. package/dist/app/mcp.svg +1 -0
  14. package/dist/app/robots.txt +14 -0
  15. package/dist/app/site.webmanifest +1 -0
  16. package/dist/app-server/app-context.d.ts +164 -0
  17. package/dist/app-server/app-context.d.ts.map +1 -0
  18. package/dist/app-server/app-context.js +2 -0
  19. package/dist/app-server/app-context.js.map +1 -0
  20. package/dist/app-server/assistant-common.d.ts +41 -0
  21. package/dist/app-server/assistant-common.d.ts.map +1 -0
  22. package/dist/app-server/assistant-common.js +104 -0
  23. package/dist/app-server/assistant-common.js.map +1 -0
  24. package/dist/app-server/config-store.d.ts +15 -0
  25. package/dist/app-server/config-store.d.ts.map +1 -0
  26. package/dist/app-server/config-store.js +67 -0
  27. package/dist/app-server/config-store.js.map +1 -0
  28. package/dist/app-server/dev-mcp.d.ts +6 -0
  29. package/dist/app-server/dev-mcp.d.ts.map +1 -0
  30. package/dist/app-server/dev-mcp.js +71 -0
  31. package/dist/app-server/dev-mcp.js.map +1 -0
  32. package/dist/app-server/evals-routes.d.ts +22 -0
  33. package/dist/app-server/evals-routes.d.ts.map +1 -0
  34. package/dist/app-server/evals-routes.js +135 -0
  35. package/dist/app-server/evals-routes.js.map +1 -0
  36. package/dist/app-server/http.d.ts +5 -0
  37. package/dist/app-server/http.d.ts.map +1 -0
  38. package/dist/app-server/http.js +31 -0
  39. package/dist/app-server/http.js.map +1 -0
  40. package/dist/app-server/index.d.ts +3 -0
  41. package/dist/app-server/index.d.ts.map +1 -0
  42. package/dist/app-server/index.js +2 -0
  43. package/dist/app-server/index.js.map +1 -0
  44. package/dist/app-server/jobs.d.ts +15 -0
  45. package/dist/app-server/jobs.d.ts.map +1 -0
  46. package/dist/app-server/jobs.js +11 -0
  47. package/dist/app-server/jobs.js.map +1 -0
  48. package/dist/app-server/libraries-store.d.ts +15 -0
  49. package/dist/app-server/libraries-store.d.ts.map +1 -0
  50. package/dist/app-server/libraries-store.js +61 -0
  51. package/dist/app-server/libraries-store.js.map +1 -0
  52. package/dist/app-server/markdown-reports.d.ts +12 -0
  53. package/dist/app-server/markdown-reports.d.ts.map +1 -0
  54. package/dist/app-server/markdown-reports.js +145 -0
  55. package/dist/app-server/markdown-reports.js.map +1 -0
  56. package/dist/app-server/oauth-debugger-domain.d.ts +230 -0
  57. package/dist/app-server/oauth-debugger-domain.d.ts.map +1 -0
  58. package/dist/app-server/oauth-debugger-domain.js +1098 -0
  59. package/dist/app-server/oauth-debugger-domain.js.map +1 -0
  60. package/dist/app-server/oauth-debugger.d.ts +20 -0
  61. package/dist/app-server/oauth-debugger.d.ts.map +1 -0
  62. package/dist/app-server/oauth-debugger.js +193 -0
  63. package/dist/app-server/oauth-debugger.js.map +1 -0
  64. package/dist/app-server/provider-models.d.ts +8 -0
  65. package/dist/app-server/provider-models.d.ts.map +1 -0
  66. package/dist/app-server/provider-models.js +60 -0
  67. package/dist/app-server/provider-models.js.map +1 -0
  68. package/dist/app-server/result-assistant-domain.d.ts +87 -0
  69. package/dist/app-server/result-assistant-domain.d.ts.map +1 -0
  70. package/dist/app-server/result-assistant-domain.js +212 -0
  71. package/dist/app-server/result-assistant-domain.js.map +1 -0
  72. package/dist/app-server/result-assistant.d.ts +22 -0
  73. package/dist/app-server/result-assistant.d.ts.map +1 -0
  74. package/dist/app-server/result-assistant.js +328 -0
  75. package/dist/app-server/result-assistant.js.map +1 -0
  76. package/dist/app-server/router.d.ts +4 -0
  77. package/dist/app-server/router.d.ts.map +1 -0
  78. package/dist/app-server/router.js +374 -0
  79. package/dist/app-server/router.js.map +1 -0
  80. package/dist/app-server/runs-routes.d.ts +44 -0
  81. package/dist/app-server/runs-routes.d.ts.map +1 -0
  82. package/dist/app-server/runs-routes.js +555 -0
  83. package/dist/app-server/runs-routes.js.map +1 -0
  84. package/dist/app-server/runs-store.d.ts +23 -0
  85. package/dist/app-server/runs-store.d.ts.map +1 -0
  86. package/dist/app-server/runs-store.js +84 -0
  87. package/dist/app-server/runs-store.js.map +1 -0
  88. package/dist/app-server/scenario-assistant-domain.d.ts +162 -0
  89. package/dist/app-server/scenario-assistant-domain.d.ts.map +1 -0
  90. package/dist/app-server/scenario-assistant-domain.js +269 -0
  91. package/dist/app-server/scenario-assistant-domain.js.map +1 -0
  92. package/dist/app-server/scenario-assistant.d.ts +29 -0
  93. package/dist/app-server/scenario-assistant.d.ts.map +1 -0
  94. package/dist/app-server/scenario-assistant.js +246 -0
  95. package/dist/app-server/scenario-assistant.js.map +1 -0
  96. package/dist/app-server/settings-store.d.ts +4 -0
  97. package/dist/app-server/settings-store.d.ts.map +1 -0
  98. package/dist/app-server/settings-store.js +32 -0
  99. package/dist/app-server/settings-store.js.map +1 -0
  100. package/dist/app-server/snapshots-routes.d.ts +24 -0
  101. package/dist/app-server/snapshots-routes.d.ts.map +1 -0
  102. package/dist/app-server/snapshots-routes.js +82 -0
  103. package/dist/app-server/snapshots-routes.js.map +1 -0
  104. package/dist/app-server/static-serving.d.ts +17 -0
  105. package/dist/app-server/static-serving.d.ts.map +1 -0
  106. package/dist/app-server/static-serving.js +64 -0
  107. package/dist/app-server/static-serving.js.map +1 -0
  108. package/dist/app-server/store-utils.d.ts +5 -0
  109. package/dist/app-server/store-utils.d.ts.map +1 -0
  110. package/dist/app-server/store-utils.js +26 -0
  111. package/dist/app-server/store-utils.js.map +1 -0
  112. package/dist/app-server/tool-analysis-domain.d.ts +146 -0
  113. package/dist/app-server/tool-analysis-domain.d.ts.map +1 -0
  114. package/dist/app-server/tool-analysis-domain.js +556 -0
  115. package/dist/app-server/tool-analysis-domain.js.map +1 -0
  116. package/dist/app-server/tool-analysis-storage.d.ts +41 -0
  117. package/dist/app-server/tool-analysis-storage.d.ts.map +1 -0
  118. package/dist/app-server/tool-analysis-storage.js +110 -0
  119. package/dist/app-server/tool-analysis-storage.js.map +1 -0
  120. package/dist/app-server/tool-analysis.d.ts +22 -0
  121. package/dist/app-server/tool-analysis.d.ts.map +1 -0
  122. package/dist/app-server/tool-analysis.js +271 -0
  123. package/dist/app-server/tool-analysis.js.map +1 -0
  124. package/dist/app-server/types.d.ts +28 -0
  125. package/dist/app-server/types.d.ts.map +1 -0
  126. package/dist/app-server/types.js +2 -0
  127. package/dist/app-server/types.js.map +1 -0
  128. package/dist/cli.d.ts +3 -0
  129. package/dist/cli.d.ts.map +1 -0
  130. package/dist/cli.js +544 -0
  131. package/dist/cli.js.map +1 -0
  132. package/dist/snapshot.d.ts +80 -0
  133. package/dist/snapshot.d.ts.map +1 -0
  134. package/dist/snapshot.js +401 -0
  135. package/dist/snapshot.js.map +1 -0
  136. package/package.json +55 -0
@@ -0,0 +1,556 @@
1
+ import { chatWithAgent, McpClientManager } from '@inspectr/mcplab-core';
2
+ import { addJobEvent } from './jobs.js';
3
+ import { readLibraries } from './libraries-store.js';
4
+ import { truncateJson } from './assistant-common.js';
5
+ import { pickDefaultAssistantAgentName, resolveAssistantAgentFromLibraries } from './scenario-assistant-domain.js';
6
+ const TOOL_ANALYSIS_READ_PREFIXES = [
7
+ 'get',
8
+ 'list',
9
+ 'search',
10
+ 'find',
11
+ 'describe',
12
+ 'read',
13
+ 'fetch',
14
+ 'lookup',
15
+ 'query',
16
+ 'inspect'
17
+ ];
18
+ const TOOL_ANALYSIS_UNSAFE_PREFIXES = [
19
+ 'create',
20
+ 'update',
21
+ 'delete',
22
+ 'remove',
23
+ 'write',
24
+ 'set',
25
+ 'patch',
26
+ 'post',
27
+ 'put',
28
+ 'execute',
29
+ 'run',
30
+ 'trigger'
31
+ ];
32
+ function classifyToolSafety(toolName, inputSchema) {
33
+ const lower = toolName.toLowerCase();
34
+ const read = TOOL_ANALYSIS_READ_PREFIXES.find((p) => lower.startsWith(p));
35
+ const unsafe = TOOL_ANALYSIS_UNSAFE_PREFIXES.find((p) => lower.startsWith(p));
36
+ if (unsafe) {
37
+ return {
38
+ safetyClassification: 'unsafe_or_unknown',
39
+ classificationReason: `Name starts with potentially side-effectful prefix '${unsafe}'.`
40
+ };
41
+ }
42
+ let schemaHint = '';
43
+ try {
44
+ const schemaText = JSON.stringify(inputSchema ?? '').toLowerCase();
45
+ if (/(confirm|force|commit|delete|write|update)/.test(schemaText)) {
46
+ schemaHint = ' Schema contains possibly mutating parameter names.';
47
+ }
48
+ }
49
+ catch {
50
+ // ignore schema stringify errors
51
+ }
52
+ if (read) {
53
+ return {
54
+ safetyClassification: 'read_like',
55
+ classificationReason: `Name starts with read-like prefix '${read}'.${schemaHint}`.trim()
56
+ };
57
+ }
58
+ return {
59
+ safetyClassification: 'unsafe_or_unknown',
60
+ classificationReason: `Tool name does not match read-only allowlist prefixes.${schemaHint}`.trim()
61
+ };
62
+ }
63
+ function normalizeToolAnalysisFinding(raw, fallbackPrefix, idx) {
64
+ const rawObj = (raw && typeof raw === 'object' ? raw : {});
65
+ const severity = rawObj.severity === 'critical' ||
66
+ rawObj.severity === 'high' ||
67
+ rawObj.severity === 'medium' ||
68
+ rawObj.severity === 'low' ||
69
+ rawObj.severity === 'info'
70
+ ? rawObj.severity
71
+ : 'info';
72
+ const scopeValues = [
73
+ 'tool_name',
74
+ 'description',
75
+ 'schema',
76
+ 'ergonomics',
77
+ 'safety',
78
+ 'eval_readiness',
79
+ 'execution'
80
+ ];
81
+ const scope = scopeValues.includes(rawObj.scope)
82
+ ? rawObj.scope
83
+ : 'eval_readiness';
84
+ return {
85
+ id: (typeof rawObj.id === 'string' && rawObj.id.trim()) ||
86
+ `${fallbackPrefix}-${idx + 1}-${Math.random().toString(36).slice(2, 6)}`,
87
+ scope,
88
+ severity,
89
+ title: String(rawObj.title ?? 'Observation'),
90
+ detail: String(rawObj.detail ?? rawObj.suggestion ?? 'No details provided'),
91
+ suggestion: rawObj.suggestion ? String(rawObj.suggestion) : undefined
92
+ };
93
+ }
94
+ function clampStringArray(value, fallback = []) {
95
+ return Array.isArray(value) ? value.map((v) => String(v)).filter(Boolean) : fallback;
96
+ }
97
+ function parseJsonFromAssistantText(text) {
98
+ const cleaned = text.trim();
99
+ try {
100
+ return JSON.parse(cleaned);
101
+ }
102
+ catch {
103
+ const fenced = cleaned.match(/```json\s*([\s\S]+?)```/i) ?? cleaned.match(/```\s*([\s\S]+?)```/i);
104
+ if (fenced)
105
+ return JSON.parse(fenced[1]);
106
+ throw new Error('Assistant returned invalid JSON');
107
+ }
108
+ }
109
+ async function chatJsonWithAgent(agent, system, userPrompt) {
110
+ const first = await chatWithAgent({
111
+ agent,
112
+ system,
113
+ messages: [{ role: 'user', content: userPrompt }]
114
+ });
115
+ try {
116
+ return parseJsonFromAssistantText(first.content ?? '');
117
+ }
118
+ catch {
119
+ const retry = await chatWithAgent({
120
+ agent,
121
+ system,
122
+ messages: [
123
+ { role: 'user', content: userPrompt },
124
+ { role: 'assistant', content: first.content ?? '' },
125
+ {
126
+ role: 'user',
127
+ content: 'Reply again with valid JSON only. No prose, no markdown fences.'
128
+ }
129
+ ]
130
+ });
131
+ return parseJsonFromAssistantText(retry.content ?? '');
132
+ }
133
+ }
134
+ function toolAnalysisMetadataSystemPrompt() {
135
+ return [
136
+ 'You are an MCP Tool Analysis Assistant.',
137
+ 'Review MCP tools for agent/workflow usability, determinism, safety signaling, and eval readiness.',
138
+ 'Return JSON only with keys:',
139
+ 'strengths: string[]',
140
+ 'issues: ToolAnalysisFinding[] (id, scope, severity, title, detail, suggestion?)',
141
+ 'suggestedDescription?: string',
142
+ 'suggestedSchemaChanges: [{type, summary, before?, after?}]',
143
+ 'evalReadinessNotes: string[]',
144
+ 'overallRecommendations: string[]',
145
+ 'Use severities: critical|high|medium|low|info.'
146
+ ].join('\n');
147
+ }
148
+ function toolAnalysisSampleArgsSystemPrompt(sampleCallsPerTool) {
149
+ return [
150
+ 'You generate safe sample MCP tool call arguments for read-only analysis.',
151
+ 'Return JSON only: {"sampleCalls":[{"arguments":{...},"rationale":"..."}]}',
152
+ `Limit to at most ${sampleCallsPerTool} sampleCalls.`,
153
+ 'Prefer minimal valid arguments based on the schema.',
154
+ 'Do not include destructive or side-effect toggles.'
155
+ ].join('\n');
156
+ }
157
+ function toolAnalysisExecutionReviewSystemPrompt() {
158
+ return [
159
+ 'You review MCP tool execution output for agent/workflow usability and eval readiness.',
160
+ 'Return JSON only with keys: observations (string[]), issues (ToolAnalysisFinding[]), recommendations (string[]).',
161
+ 'Focus on output shape consistency, error quality, schema-doc mismatches, and determinism risks.'
162
+ ].join('\n');
163
+ }
164
+ export async function discoverMcpToolsForServers(serversByName, serverNames) {
165
+ const mcp = new McpClientManager();
166
+ const discovered = [];
167
+ for (const serverName of serverNames) {
168
+ const server = serversByName[serverName];
169
+ const entry = { serverName, warnings: [], tools: [] };
170
+ if (!server) {
171
+ entry.warnings.push(`Server '${serverName}' not found.`);
172
+ discovered.push(entry);
173
+ continue;
174
+ }
175
+ try {
176
+ await mcp.connectAll({ [serverName]: server });
177
+ const tools = await mcp.listTools(serverName);
178
+ entry.tools = tools.map((tool) => {
179
+ const safety = classifyToolSafety(tool.name, tool.inputSchema);
180
+ return {
181
+ serverName,
182
+ tool,
183
+ safetyClassification: safety.safetyClassification,
184
+ classificationReason: safety.classificationReason
185
+ };
186
+ });
187
+ }
188
+ catch (error) {
189
+ entry.warnings.push(`Failed to load tools: ${error instanceof Error ? error.message : String(error)}`);
190
+ }
191
+ discovered.push(entry);
192
+ }
193
+ return { mcp, servers: discovered };
194
+ }
195
+ function timeoutPromise(promise, timeoutMs, label) {
196
+ let timer;
197
+ const timeout = new Promise((_, reject) => {
198
+ timer = setTimeout(() => reject(new Error(`${label} timed out after ${timeoutMs}ms`)), timeoutMs);
199
+ });
200
+ return Promise.race([promise, timeout]).finally(() => {
201
+ if (timer)
202
+ clearTimeout(timer);
203
+ });
204
+ }
205
+ function summarizeToolResultForReport(result, maxChars = 8000) {
206
+ return truncateJson(result, maxChars);
207
+ }
208
+ export async function runToolAnalysisJob(params) {
209
+ const { job, settings, serverNames, selectedToolsByServer, modes, deeper, maxParallelTools } = params;
210
+ const libraries = readLibraries(settings.librariesDir);
211
+ const selectedAssistantAgentName = pickDefaultAssistantAgentName({
212
+ requested: params.requestedAssistantAgentName,
213
+ settingsDefault: settings.scenarioAssistantAgentName,
214
+ agentNames: Object.keys(libraries.agents)
215
+ });
216
+ if (!selectedAssistantAgentName) {
217
+ throw new Error('No assistant agent available. Configure one in Settings or add a library agent.');
218
+ }
219
+ const agentConfig = resolveAssistantAgentFromLibraries(libraries, selectedAssistantAgentName);
220
+ addJobEvent(job, {
221
+ type: 'log',
222
+ ts: new Date().toISOString(),
223
+ payload: {
224
+ message: `Using assistant agent ${selectedAssistantAgentName} (${agentConfig.provider}/${agentConfig.model})`
225
+ }
226
+ });
227
+ const { mcp, servers: discoveredServers } = await discoverMcpToolsForServers(libraries.servers, serverNames);
228
+ try {
229
+ const serverReports = [];
230
+ const allFindings = [];
231
+ const issueCounts = { critical: 0, high: 0, medium: 0, low: 0, info: 0 };
232
+ let toolsSkipped = 0;
233
+ for (const discovered of discoveredServers) {
234
+ if (job.abortController.signal.aborted)
235
+ throw new Error('Tool analysis aborted by user');
236
+ addJobEvent(job, {
237
+ type: 'log',
238
+ ts: new Date().toISOString(),
239
+ payload: {
240
+ message: `Analyzing server ${discovered.serverName} (${discovered.tools.length} tools)`
241
+ }
242
+ });
243
+ const requestedToolNames = selectedToolsByServer?.[discovered.serverName];
244
+ const requestedSet = requestedToolNames ? new Set(requestedToolNames) : null;
245
+ const selectedTools = requestedSet
246
+ ? discovered.tools.filter((t) => requestedSet.has(t.tool.name))
247
+ : discovered.tools;
248
+ const missingRequested = requestedSet
249
+ ? requestedToolNames.filter((name) => !discovered.tools.some((t) => t.tool.name === name))
250
+ : [];
251
+ const toolReports = new Array(selectedTools.length);
252
+ const perToolFindings = new Array(selectedTools.length);
253
+ const perToolSkipped = new Array(selectedTools.length).fill(false);
254
+ const analyzeToolAtIndex = async (toolIndex) => {
255
+ const toolCtx = selectedTools[toolIndex];
256
+ if (job.abortController.signal.aborted)
257
+ throw new Error('Tool analysis aborted by user');
258
+ addJobEvent(job, {
259
+ type: 'log',
260
+ ts: new Date().toISOString(),
261
+ payload: {
262
+ kind: 'tool_progress',
263
+ phase: 'started',
264
+ serverName: discovered.serverName,
265
+ toolName: toolCtx.tool.name,
266
+ message: `Started ${discovered.serverName}::${toolCtx.tool.name}`
267
+ }
268
+ });
269
+ const baseReport = {
270
+ serverName: discovered.serverName,
271
+ toolName: toolCtx.tool.name,
272
+ publicToolName: `${discovered.serverName}::${toolCtx.tool.name}`,
273
+ description: toolCtx.tool.description,
274
+ inputSchema: toolCtx.tool.inputSchema,
275
+ safetyClassification: toolCtx.safetyClassification,
276
+ classificationReason: toolCtx.classificationReason,
277
+ overallRecommendations: []
278
+ };
279
+ if (modes.metadataReview) {
280
+ addJobEvent(job, {
281
+ type: 'log',
282
+ ts: new Date().toISOString(),
283
+ payload: { message: `Metadata review: ${discovered.serverName}::${toolCtx.tool.name}` }
284
+ });
285
+ try {
286
+ const metaJson = (await chatJsonWithAgent(agentConfig, toolAnalysisMetadataSystemPrompt(), JSON.stringify({
287
+ serverName: discovered.serverName,
288
+ toolName: toolCtx.tool.name,
289
+ description: toolCtx.tool.description ?? '',
290
+ inputSchema: toolCtx.tool.inputSchema ?? null,
291
+ projectGoal: 'MCP agent/workflow evaluation friendliness'
292
+ })));
293
+ const issues = Array.isArray(metaJson.issues)
294
+ ? metaJson.issues.map((item, idx) => normalizeToolAnalysisFinding(item, `meta-${discovered.serverName}-${toolCtx.tool.name}`, idx))
295
+ : [];
296
+ baseReport.metadataReview = {
297
+ strengths: clampStringArray(metaJson.strengths),
298
+ issues,
299
+ suggestedDescription: typeof metaJson.suggestedDescription === 'string'
300
+ ? metaJson.suggestedDescription
301
+ : undefined,
302
+ suggestedSchemaChanges: Array.isArray(metaJson.suggestedSchemaChanges)
303
+ ? metaJson.suggestedSchemaChanges.map((c) => {
304
+ const change = (c && typeof c === 'object' ? c : {});
305
+ return {
306
+ type: [
307
+ 'description',
308
+ 'parameter',
309
+ 'required',
310
+ 'enum',
311
+ 'constraints',
312
+ 'examples',
313
+ 'naming'
314
+ ].includes(change.type)
315
+ ? change.type
316
+ : 'parameter',
317
+ summary: String(change.summary ?? 'Suggested change'),
318
+ before: change.before ? String(change.before) : undefined,
319
+ after: change.after ? String(change.after) : undefined
320
+ };
321
+ })
322
+ : [],
323
+ evalReadinessNotes: clampStringArray(metaJson.evalReadinessNotes)
324
+ };
325
+ baseReport.overallRecommendations.push(...clampStringArray(metaJson.overallRecommendations));
326
+ }
327
+ catch (error) {
328
+ baseReport.metadataReview = {
329
+ strengths: [],
330
+ issues: [
331
+ normalizeToolAnalysisFinding({
332
+ scope: 'schema',
333
+ severity: 'medium',
334
+ title: 'Metadata review failed',
335
+ detail: error instanceof Error ? error.message : String(error),
336
+ suggestion: 'Retry with a different assistant agent or simplify the tool schema.'
337
+ }, `meta-fail-${toolCtx.tool.name}`, 0)
338
+ ],
339
+ suggestedSchemaChanges: [],
340
+ evalReadinessNotes: []
341
+ };
342
+ }
343
+ }
344
+ if (modes.deeperAnalysis) {
345
+ const canAutoRun = deeper.autoRunPolicy !== 'read_only_allowlist' ||
346
+ toolCtx.safetyClassification === 'read_like';
347
+ if (!canAutoRun) {
348
+ baseReport.deeperAnalysis = {
349
+ attempted: false,
350
+ skippedReason: `Skipped by safety policy (${deeper.autoRunPolicy}): ${toolCtx.classificationReason}`,
351
+ sampleCalls: [],
352
+ overallObservations: []
353
+ };
354
+ perToolSkipped[toolIndex] = true;
355
+ }
356
+ else {
357
+ addJobEvent(job, {
358
+ type: 'log',
359
+ ts: new Date().toISOString(),
360
+ payload: {
361
+ message: `Deeper analysis: ${discovered.serverName}::${toolCtx.tool.name}`
362
+ }
363
+ });
364
+ const sampleCalls = [];
365
+ let overallObservations = [];
366
+ try {
367
+ const samplePlan = (await chatJsonWithAgent(agentConfig, toolAnalysisSampleArgsSystemPrompt(deeper.sampleCallsPerTool), JSON.stringify({
368
+ serverName: discovered.serverName,
369
+ toolName: toolCtx.tool.name,
370
+ description: toolCtx.tool.description ?? '',
371
+ inputSchema: toolCtx.tool.inputSchema ?? null,
372
+ maxCalls: deeper.sampleCallsPerTool
373
+ })));
374
+ const suggestedSamples = Array.isArray(samplePlan.sampleCalls)
375
+ ? samplePlan.sampleCalls.slice(0, deeper.sampleCallsPerTool)
376
+ : [{ arguments: {} }];
377
+ for (let idx = 0; idx < suggestedSamples.length; idx += 1) {
378
+ const suggestedArgs = suggestedSamples[idx]?.arguments ?? {};
379
+ const started = Date.now();
380
+ try {
381
+ const result = await timeoutPromise(mcp.callTool(discovered.serverName, toolCtx.tool.name, suggestedArgs), deeper.toolCallTimeoutMs, `${discovered.serverName}::${toolCtx.tool.name}`);
382
+ const durationMs = Date.now() - started;
383
+ const resultPreview = summarizeToolResultForReport(result, 8000);
384
+ let execReview = {};
385
+ try {
386
+ execReview = (await chatJsonWithAgent(agentConfig, toolAnalysisExecutionReviewSystemPrompt(), JSON.stringify({
387
+ serverName: discovered.serverName,
388
+ toolName: toolCtx.tool.name,
389
+ arguments: suggestedArgs,
390
+ resultPreview: truncateJson(result, 4000),
391
+ description: toolCtx.tool.description ?? '',
392
+ inputSchema: toolCtx.tool.inputSchema ?? null
393
+ })));
394
+ }
395
+ catch (error) {
396
+ execReview = {
397
+ observations: [
398
+ `Execution review failed: ${error instanceof Error ? error.message : String(error)}`
399
+ ],
400
+ issues: [],
401
+ recommendations: []
402
+ };
403
+ }
404
+ const issues = Array.isArray(execReview.issues)
405
+ ? execReview.issues.map((it, j) => normalizeToolAnalysisFinding({
406
+ ...(it && typeof it === 'object'
407
+ ? it
408
+ : {}),
409
+ scope: it && typeof it === 'object' && 'scope' in it
410
+ ? it.scope
411
+ : 'execution'
412
+ }, `exec-${discovered.serverName}-${toolCtx.tool.name}-${idx}`, j))
413
+ : [];
414
+ sampleCalls.push({
415
+ callIndex: idx + 1,
416
+ arguments: suggestedArgs,
417
+ ok: true,
418
+ durationMs,
419
+ resultPreview,
420
+ observations: clampStringArray(execReview.observations),
421
+ issues
422
+ });
423
+ baseReport.overallRecommendations.push(...clampStringArray(execReview.recommendations));
424
+ }
425
+ catch (error) {
426
+ sampleCalls.push({
427
+ callIndex: idx + 1,
428
+ arguments: suggestedArgs,
429
+ ok: false,
430
+ durationMs: Date.now() - started,
431
+ error: error instanceof Error ? error.message : String(error),
432
+ observations: [],
433
+ issues: [
434
+ normalizeToolAnalysisFinding({
435
+ scope: 'execution',
436
+ severity: 'medium',
437
+ title: 'Sample call failed',
438
+ detail: error instanceof Error ? error.message : String(error)
439
+ }, `exec-fail-${discovered.serverName}-${toolCtx.tool.name}`, idx)
440
+ ]
441
+ });
442
+ }
443
+ }
444
+ overallObservations = sampleCalls
445
+ .flatMap((call) => call.observations)
446
+ .slice(0, 20);
447
+ baseReport.deeperAnalysis = {
448
+ attempted: true,
449
+ sampleCalls,
450
+ overallObservations
451
+ };
452
+ }
453
+ catch (error) {
454
+ baseReport.deeperAnalysis = {
455
+ attempted: true,
456
+ sampleCalls: [
457
+ {
458
+ callIndex: 1,
459
+ arguments: {},
460
+ ok: false,
461
+ error: error instanceof Error ? error.message : String(error),
462
+ observations: [],
463
+ issues: [
464
+ normalizeToolAnalysisFinding({
465
+ scope: 'execution',
466
+ severity: 'medium',
467
+ title: 'Deeper analysis failed',
468
+ detail: error instanceof Error ? error.message : String(error)
469
+ }, `deeper-fail-${toolCtx.tool.name}`, 0)
470
+ ]
471
+ }
472
+ ],
473
+ overallObservations
474
+ };
475
+ }
476
+ }
477
+ }
478
+ const toolFindings = [
479
+ ...(baseReport.metadataReview?.issues ?? []),
480
+ ...(baseReport.deeperAnalysis?.sampleCalls.flatMap((c) => c.issues) ?? [])
481
+ ];
482
+ toolReports[toolIndex] = baseReport;
483
+ perToolFindings[toolIndex] = toolFindings;
484
+ addJobEvent(job, {
485
+ type: 'log',
486
+ ts: new Date().toISOString(),
487
+ payload: {
488
+ kind: 'tool_progress',
489
+ phase: 'finished',
490
+ serverName: discovered.serverName,
491
+ toolName: toolCtx.tool.name,
492
+ findings: toolFindings.length,
493
+ skipped: baseReport.deeperAnalysis?.attempted === false,
494
+ message: `Finished ${discovered.serverName}::${toolCtx.tool.name}`
495
+ }
496
+ });
497
+ };
498
+ const concurrency = Math.max(1, Math.min(maxParallelTools, selectedTools.length || 1));
499
+ let nextToolIndex = 0;
500
+ await Promise.all(Array.from({ length: concurrency }, async () => {
501
+ while (true) {
502
+ if (job.abortController.signal.aborted)
503
+ throw new Error('Tool analysis aborted by user');
504
+ const current = nextToolIndex;
505
+ nextToolIndex += 1;
506
+ if (current >= selectedTools.length)
507
+ return;
508
+ await analyzeToolAtIndex(current);
509
+ }
510
+ }));
511
+ for (const findings of perToolFindings) {
512
+ for (const finding of findings ?? []) {
513
+ allFindings.push(finding);
514
+ issueCounts[finding.severity] += 1;
515
+ }
516
+ }
517
+ toolsSkipped += perToolSkipped.filter(Boolean).length;
518
+ serverReports.push({
519
+ serverName: discovered.serverName,
520
+ toolCountDiscovered: discovered.tools.length,
521
+ toolCountAnalyzed: toolReports.length,
522
+ toolCountSkipped: toolReports.filter((tool) => tool.deeperAnalysis && tool.deeperAnalysis.attempted === false).length,
523
+ warnings: [
524
+ ...discovered.warnings,
525
+ ...missingRequested.map((name) => `Requested tool not found: ${name}`)
526
+ ],
527
+ tools: toolReports
528
+ });
529
+ }
530
+ job.result = {
531
+ schemaVersion: 1,
532
+ createdAt: new Date().toISOString(),
533
+ assistantAgentName: selectedAssistantAgentName,
534
+ assistantAgentModel: agentConfig.model,
535
+ modes,
536
+ settings: {
537
+ autoRunPolicy: modes.deeperAnalysis ? deeper.autoRunPolicy : undefined,
538
+ sampleCallsPerTool: modes.deeperAnalysis ? deeper.sampleCallsPerTool : undefined,
539
+ toolCallTimeoutMs: modes.deeperAnalysis ? deeper.toolCallTimeoutMs : undefined,
540
+ maxParallelTools
541
+ },
542
+ summary: {
543
+ serversAnalyzed: serverReports.length,
544
+ toolsAnalyzed: serverReports.reduce((sum, s) => sum + s.toolCountAnalyzed, 0),
545
+ toolsSkipped,
546
+ issueCounts
547
+ },
548
+ servers: serverReports,
549
+ findings: allFindings
550
+ };
551
+ }
552
+ finally {
553
+ // McpClientManager currently has no explicit close lifecycle API.
554
+ }
555
+ }
556
+ //# sourceMappingURL=tool-analysis-domain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-analysis-domain.js","sourceRoot":"","sources":["../../src/app-server/tool-analysis-domain.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAExE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EACL,6BAA6B,EAC7B,kCAAkC,EACnC,MAAM,gCAAgC,CAAC;AAkKxC,MAAM,2BAA2B,GAAG;IAClC,KAAK;IACL,MAAM;IACN,QAAQ;IACR,MAAM;IACN,UAAU;IACV,MAAM;IACN,OAAO;IACP,QAAQ;IACR,OAAO;IACP,SAAS;CACV,CAAC;AAEF,MAAM,6BAA6B,GAAG;IACpC,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,KAAK;IACL,OAAO;IACP,MAAM;IACN,KAAK;IACL,SAAS;IACT,KAAK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AAkB,EAAE,0BAA0B;YAC9C,mBAAmB,EAAE,WAAW,CAAC,KAAK;YACtC,KAAK;YACL,QAAQ,EAAE;gBACR,aAAa,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS;gBACtE,kBAAkB,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS;gBAChF,iBAAiB,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS;gBAC9E,gBAAgB;aACjB;YACD,OAAO,EAAE;gBACP,eAAe,EAAE,aAAa,CAAC,MAAM;gBACrC,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,iBAAiB,EAAE,CAAC,CAAC;gBAC7E,YAAY;gBACZ,WAAW;aACZ;YACD,OAAO,EAAE,aAAa;YACtB,QAAQ,EAAE,WAAW;SACtB,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,kEAAkE;IACpE,CAAC;AACH,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { ToolAnalysisReport } from './tool-analysis-domain.js';
2
+ export interface SavedToolAnalysisReportRecord {
3
+ recordVersion: 1;
4
+ reportId: string;
5
+ createdAt: string;
6
+ sourceJobId: string;
7
+ serverNames: string[];
8
+ report: ToolAnalysisReport;
9
+ }
10
+ export interface ToolAnalysisResultSummary {
11
+ reportId: string;
12
+ createdAt: string;
13
+ assistantAgentName: string;
14
+ assistantAgentModel: string;
15
+ serverNames: string[];
16
+ modes: ToolAnalysisReport['modes'];
17
+ summary: ToolAnalysisReport['summary'];
18
+ }
19
+ export declare function createToolAnalysisReportId(date?: Date): string;
20
+ export declare function writeToolAnalysisReportRecord(
21
+ baseDir: string,
22
+ record: SavedToolAnalysisReportRecord
23
+ ): string;
24
+ export declare function readToolAnalysisReportRecord(
25
+ baseDir: string,
26
+ reportId: string
27
+ ): SavedToolAnalysisReportRecord | null;
28
+ export declare function listToolAnalysisReports(baseDir: string): ToolAnalysisResultSummary[];
29
+ export declare function deleteToolAnalysisReportRecord(baseDir: string, reportId: string): boolean;
30
+ export declare function listToolAnalysisReportsFromDirs(
31
+ baseDirs: string[]
32
+ ): ToolAnalysisResultSummary[];
33
+ export declare function readToolAnalysisReportRecordFromDirs(
34
+ baseDirs: string[],
35
+ reportId: string
36
+ ): SavedToolAnalysisReportRecord | null;
37
+ export declare function deleteToolAnalysisReportRecordFromDirs(
38
+ baseDirs: string[],
39
+ reportId: string
40
+ ): boolean;
41
+ //# sourceMappingURL=tool-analysis-storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-analysis-storage.d.ts","sourceRoot":"","sources":["../../src/app-server/tool-analysis-storage.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,MAAM,WAAW,6BAA6B;IAC5C,aAAa,EAAE,CAAC,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,MAAM,EAAE,kBAAkB,CAAC;CAC5B;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACnC,OAAO,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;CACxC;AAyBD,wBAAgB,0BAA0B,CAAC,IAAI,OAAa,GAAG,MAAM,CAOpE;AAED,w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