@bryan-thompson/inspector-assessment-client 1.11.1 → 1.13.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/assets/{OAuthCallback-DA2koy6X.js → OAuthCallback-D8KW6pFf.js} +1 -1
- package/dist/assets/{OAuthDebugCallback-Bx60PQTT.js → OAuthDebugCallback-D15nNAOl.js} +1 -1
- package/dist/assets/{index-kJ0jPd4m.js → index-cVkEgqCc.js} +130 -5
- package/dist/index.html +1 -1
- package/lib/lib/assessmentTypes.d.ts +72 -1
- package/lib/lib/assessmentTypes.d.ts.map +1 -1
- package/lib/lib/policyMapping.d.ts +183 -0
- package/lib/lib/policyMapping.d.ts.map +1 -0
- package/lib/lib/policyMapping.js +442 -0
- package/lib/lib/reportFormatters/MarkdownReportFormatter.d.ts +91 -0
- package/lib/lib/reportFormatters/MarkdownReportFormatter.d.ts.map +1 -0
- package/lib/lib/reportFormatters/MarkdownReportFormatter.js +498 -0
- package/lib/lib/reportFormatters/index.d.ts +50 -0
- package/lib/lib/reportFormatters/index.d.ts.map +1 -0
- package/lib/lib/reportFormatters/index.js +81 -0
- package/lib/lib/securityPatterns.d.ts +3 -3
- package/lib/lib/securityPatterns.d.ts.map +1 -1
- package/lib/lib/securityPatterns.js +129 -4
- package/lib/services/assessment/AssessmentOrchestrator.d.ts.map +1 -1
- package/lib/services/assessment/AssessmentOrchestrator.js +8 -0
- package/lib/services/assessment/PolicyComplianceGenerator.d.ts +119 -0
- package/lib/services/assessment/PolicyComplianceGenerator.d.ts.map +1 -0
- package/lib/services/assessment/PolicyComplianceGenerator.js +632 -0
- package/lib/services/assessment/config/annotationPatterns.d.ts +70 -0
- package/lib/services/assessment/config/annotationPatterns.d.ts.map +1 -0
- package/lib/services/assessment/config/annotationPatterns.js +305 -0
- package/lib/services/assessment/modules/ToolAnnotationAssessor.d.ts +22 -2
- package/lib/services/assessment/modules/ToolAnnotationAssessor.d.ts.map +1 -1
- package/lib/services/assessment/modules/ToolAnnotationAssessor.js +289 -152
- package/package.json +1 -1
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Annotation Pattern Configuration
|
|
3
|
+
*
|
|
4
|
+
* Configurable pattern system for inferring expected tool behavior from names.
|
|
5
|
+
* Supports JSON configuration files for customization.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Pattern configuration for tool behavior inference.
|
|
9
|
+
* Each category contains string patterns that are converted to RegExp at runtime.
|
|
10
|
+
* Patterns should end with underscore or hyphen (e.g., "get_", "delete-")
|
|
11
|
+
*/
|
|
12
|
+
export interface AnnotationPatternConfig {
|
|
13
|
+
/** Patterns indicating read-only operations (e.g., "get_", "list_", "fetch_") */
|
|
14
|
+
readOnly: string[];
|
|
15
|
+
/** Patterns indicating destructive operations (e.g., "delete_", "remove_", "destroy_") */
|
|
16
|
+
destructive: string[];
|
|
17
|
+
/** Patterns indicating write operations that are not destructive (e.g., "create_", "add_") */
|
|
18
|
+
write: string[];
|
|
19
|
+
/** Patterns that are semantically ambiguous - behavior varies by implementation */
|
|
20
|
+
ambiguous: string[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Compiled patterns ready for matching.
|
|
24
|
+
* String patterns are converted to RegExp objects.
|
|
25
|
+
*/
|
|
26
|
+
export interface CompiledPatterns {
|
|
27
|
+
readOnly: RegExp[];
|
|
28
|
+
destructive: RegExp[];
|
|
29
|
+
write: RegExp[];
|
|
30
|
+
ambiguous: RegExp[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Result of pattern matching with confidence scoring.
|
|
34
|
+
*/
|
|
35
|
+
export interface PatternMatchResult {
|
|
36
|
+
category: "readOnly" | "destructive" | "write" | "ambiguous" | "unknown";
|
|
37
|
+
pattern: string | null;
|
|
38
|
+
confidence: "high" | "medium" | "low";
|
|
39
|
+
isAmbiguous: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Default annotation patterns.
|
|
43
|
+
* These patterns have been validated against real-world MCP servers.
|
|
44
|
+
*/
|
|
45
|
+
export declare const DEFAULT_ANNOTATION_PATTERNS: AnnotationPatternConfig;
|
|
46
|
+
/**
|
|
47
|
+
* Compile string patterns into RegExp objects for efficient matching.
|
|
48
|
+
*/
|
|
49
|
+
export declare function compilePatterns(config: AnnotationPatternConfig): CompiledPatterns;
|
|
50
|
+
/**
|
|
51
|
+
* Load pattern configuration from a JSON file.
|
|
52
|
+
* Partial configs are merged with defaults.
|
|
53
|
+
*
|
|
54
|
+
* @param configPath - Path to JSON configuration file
|
|
55
|
+
* @returns Merged configuration with defaults
|
|
56
|
+
*/
|
|
57
|
+
export declare function loadPatternConfig(configPath?: string): AnnotationPatternConfig;
|
|
58
|
+
/**
|
|
59
|
+
* Match a tool name against compiled patterns and return the result.
|
|
60
|
+
*
|
|
61
|
+
* @param toolName - The tool name to match
|
|
62
|
+
* @param patterns - Compiled pattern sets
|
|
63
|
+
* @returns Match result with category, confidence, and ambiguity flag
|
|
64
|
+
*/
|
|
65
|
+
export declare function matchToolPattern(toolName: string, patterns: CompiledPatterns): PatternMatchResult;
|
|
66
|
+
/**
|
|
67
|
+
* Get compiled default patterns (cached for performance).
|
|
68
|
+
*/
|
|
69
|
+
export declare function getDefaultCompiledPatterns(): CompiledPatterns;
|
|
70
|
+
//# sourceMappingURL=annotationPatterns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotationPatterns.d.ts","sourceRoot":"","sources":["../../../../src/services/assessment/config/annotationPatterns.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,iFAAiF;IACjF,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,0FAA0F;IAC1F,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,8FAA8F;IAC9F,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,mFAAmF;IACnF,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,UAAU,GAAG,aAAa,GAAG,OAAO,GAAG,WAAW,GAAG,SAAS,CAAC;IACzE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IACtC,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,2BAA2B,EAAE,uBAqKzC,CAAC;AAoBF;;GAEG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,uBAAuB,GAC9B,gBAAgB,CAOlB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,CAAC,EAAE,MAAM,GAClB,uBAAuB,CAyBzB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,gBAAgB,GACzB,kBAAkB,CA0DpB;AAOD;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,gBAAgB,CAK7D"}
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Annotation Pattern Configuration
|
|
3
|
+
*
|
|
4
|
+
* Configurable pattern system for inferring expected tool behavior from names.
|
|
5
|
+
* Supports JSON configuration files for customization.
|
|
6
|
+
*/
|
|
7
|
+
import * as fs from "fs";
|
|
8
|
+
/**
|
|
9
|
+
* Default annotation patterns.
|
|
10
|
+
* These patterns have been validated against real-world MCP servers.
|
|
11
|
+
*/
|
|
12
|
+
export const DEFAULT_ANNOTATION_PATTERNS = {
|
|
13
|
+
readOnly: [
|
|
14
|
+
"get_",
|
|
15
|
+
"get-",
|
|
16
|
+
"list_",
|
|
17
|
+
"list-",
|
|
18
|
+
"fetch_",
|
|
19
|
+
"fetch-",
|
|
20
|
+
"read_",
|
|
21
|
+
"read-",
|
|
22
|
+
"query_",
|
|
23
|
+
"query-",
|
|
24
|
+
"search_",
|
|
25
|
+
"search-",
|
|
26
|
+
"find_",
|
|
27
|
+
"find-",
|
|
28
|
+
"show_",
|
|
29
|
+
"show-",
|
|
30
|
+
"view_",
|
|
31
|
+
"view-",
|
|
32
|
+
"describe_",
|
|
33
|
+
"describe-",
|
|
34
|
+
"check_",
|
|
35
|
+
"check-",
|
|
36
|
+
"verify_",
|
|
37
|
+
"verify-",
|
|
38
|
+
"validate_",
|
|
39
|
+
"validate-",
|
|
40
|
+
"count_",
|
|
41
|
+
"count-",
|
|
42
|
+
"status_",
|
|
43
|
+
"status-",
|
|
44
|
+
"info_",
|
|
45
|
+
"info-",
|
|
46
|
+
"lookup_",
|
|
47
|
+
"lookup-",
|
|
48
|
+
"browse_",
|
|
49
|
+
"browse-",
|
|
50
|
+
"preview_",
|
|
51
|
+
"preview-",
|
|
52
|
+
"download_",
|
|
53
|
+
"download-",
|
|
54
|
+
],
|
|
55
|
+
destructive: [
|
|
56
|
+
"delete_",
|
|
57
|
+
"delete-",
|
|
58
|
+
"remove_",
|
|
59
|
+
"remove-",
|
|
60
|
+
"destroy_",
|
|
61
|
+
"destroy-",
|
|
62
|
+
"drop_",
|
|
63
|
+
"drop-",
|
|
64
|
+
"purge_",
|
|
65
|
+
"purge-",
|
|
66
|
+
"clear_",
|
|
67
|
+
"clear-",
|
|
68
|
+
"wipe_",
|
|
69
|
+
"wipe-",
|
|
70
|
+
"erase_",
|
|
71
|
+
"erase-",
|
|
72
|
+
"reset_",
|
|
73
|
+
"reset-",
|
|
74
|
+
"truncate_",
|
|
75
|
+
"truncate-",
|
|
76
|
+
"revoke_",
|
|
77
|
+
"revoke-",
|
|
78
|
+
"terminate_",
|
|
79
|
+
"terminate-",
|
|
80
|
+
"cancel_",
|
|
81
|
+
"cancel-",
|
|
82
|
+
"kill_",
|
|
83
|
+
"kill-",
|
|
84
|
+
"force_",
|
|
85
|
+
"force-",
|
|
86
|
+
],
|
|
87
|
+
write: [
|
|
88
|
+
"create_",
|
|
89
|
+
"create-",
|
|
90
|
+
"add_",
|
|
91
|
+
"add-",
|
|
92
|
+
"insert_",
|
|
93
|
+
"insert-",
|
|
94
|
+
"update_",
|
|
95
|
+
"update-",
|
|
96
|
+
"modify_",
|
|
97
|
+
"modify-",
|
|
98
|
+
"edit_",
|
|
99
|
+
"edit-",
|
|
100
|
+
"change_",
|
|
101
|
+
"change-",
|
|
102
|
+
"set_",
|
|
103
|
+
"set-",
|
|
104
|
+
"put_",
|
|
105
|
+
"put-",
|
|
106
|
+
"patch_",
|
|
107
|
+
"patch-",
|
|
108
|
+
"post_",
|
|
109
|
+
"post-",
|
|
110
|
+
"write_",
|
|
111
|
+
"write-",
|
|
112
|
+
"upload_",
|
|
113
|
+
"upload-",
|
|
114
|
+
"send_",
|
|
115
|
+
"send-",
|
|
116
|
+
"submit_",
|
|
117
|
+
"submit-",
|
|
118
|
+
"publish_",
|
|
119
|
+
"publish-",
|
|
120
|
+
"enable_",
|
|
121
|
+
"enable-",
|
|
122
|
+
"disable_",
|
|
123
|
+
"disable-",
|
|
124
|
+
"start_",
|
|
125
|
+
"start-",
|
|
126
|
+
"stop_",
|
|
127
|
+
"stop-",
|
|
128
|
+
"run_",
|
|
129
|
+
"run-",
|
|
130
|
+
"execute_",
|
|
131
|
+
"execute-",
|
|
132
|
+
],
|
|
133
|
+
ambiguous: [
|
|
134
|
+
"store_",
|
|
135
|
+
"store-",
|
|
136
|
+
"queue_",
|
|
137
|
+
"queue-",
|
|
138
|
+
"cache_",
|
|
139
|
+
"cache-",
|
|
140
|
+
"process_",
|
|
141
|
+
"process-",
|
|
142
|
+
"handle_",
|
|
143
|
+
"handle-",
|
|
144
|
+
"manage_",
|
|
145
|
+
"manage-",
|
|
146
|
+
"sync_",
|
|
147
|
+
"sync-",
|
|
148
|
+
"transfer_",
|
|
149
|
+
"transfer-",
|
|
150
|
+
"push_",
|
|
151
|
+
"push-",
|
|
152
|
+
"pop_",
|
|
153
|
+
"pop-",
|
|
154
|
+
"apply_",
|
|
155
|
+
"apply-",
|
|
156
|
+
"compute_",
|
|
157
|
+
"compute-",
|
|
158
|
+
"calculate_",
|
|
159
|
+
"calculate-",
|
|
160
|
+
"transform_",
|
|
161
|
+
"transform-",
|
|
162
|
+
"convert_",
|
|
163
|
+
"convert-",
|
|
164
|
+
"evaluate_",
|
|
165
|
+
"evaluate-",
|
|
166
|
+
"log_",
|
|
167
|
+
"log-",
|
|
168
|
+
"record_",
|
|
169
|
+
"record-",
|
|
170
|
+
"track_",
|
|
171
|
+
"track-",
|
|
172
|
+
"register_",
|
|
173
|
+
"register-",
|
|
174
|
+
"save_",
|
|
175
|
+
"save-",
|
|
176
|
+
],
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* Convert a string pattern to a RegExp.
|
|
180
|
+
* Handles patterns like "get_" -> /^get[_-]?/i
|
|
181
|
+
*/
|
|
182
|
+
function patternToRegex(pattern) {
|
|
183
|
+
// Remove trailing underscore/hyphen for the base pattern
|
|
184
|
+
const base = pattern.replace(/[_-]$/, "");
|
|
185
|
+
// Create regex that matches pattern at start of string, with optional underscore/hyphen
|
|
186
|
+
return new RegExp(`^${escapeRegex(base)}[_-]?`, "i");
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Escape special regex characters in a string.
|
|
190
|
+
*/
|
|
191
|
+
function escapeRegex(str) {
|
|
192
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Compile string patterns into RegExp objects for efficient matching.
|
|
196
|
+
*/
|
|
197
|
+
export function compilePatterns(config) {
|
|
198
|
+
return {
|
|
199
|
+
readOnly: config.readOnly.map(patternToRegex),
|
|
200
|
+
destructive: config.destructive.map(patternToRegex),
|
|
201
|
+
write: config.write.map(patternToRegex),
|
|
202
|
+
ambiguous: config.ambiguous.map(patternToRegex),
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Load pattern configuration from a JSON file.
|
|
207
|
+
* Partial configs are merged with defaults.
|
|
208
|
+
*
|
|
209
|
+
* @param configPath - Path to JSON configuration file
|
|
210
|
+
* @returns Merged configuration with defaults
|
|
211
|
+
*/
|
|
212
|
+
export function loadPatternConfig(configPath) {
|
|
213
|
+
if (!configPath) {
|
|
214
|
+
return DEFAULT_ANNOTATION_PATTERNS;
|
|
215
|
+
}
|
|
216
|
+
try {
|
|
217
|
+
const configContent = fs.readFileSync(configPath, "utf-8");
|
|
218
|
+
const userConfig = JSON.parse(configContent);
|
|
219
|
+
// Merge with defaults - user config overrides defaults for specified categories
|
|
220
|
+
return {
|
|
221
|
+
readOnly: userConfig.readOnly ?? DEFAULT_ANNOTATION_PATTERNS.readOnly,
|
|
222
|
+
destructive: userConfig.destructive ?? DEFAULT_ANNOTATION_PATTERNS.destructive,
|
|
223
|
+
write: userConfig.write ?? DEFAULT_ANNOTATION_PATTERNS.write,
|
|
224
|
+
ambiguous: userConfig.ambiguous ?? DEFAULT_ANNOTATION_PATTERNS.ambiguous,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
console.warn(`Warning: Could not load pattern config from ${configPath}, using defaults`);
|
|
229
|
+
return DEFAULT_ANNOTATION_PATTERNS;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Match a tool name against compiled patterns and return the result.
|
|
234
|
+
*
|
|
235
|
+
* @param toolName - The tool name to match
|
|
236
|
+
* @param patterns - Compiled pattern sets
|
|
237
|
+
* @returns Match result with category, confidence, and ambiguity flag
|
|
238
|
+
*/
|
|
239
|
+
export function matchToolPattern(toolName, patterns) {
|
|
240
|
+
const lowerName = toolName.toLowerCase();
|
|
241
|
+
// Check ambiguous patterns FIRST (highest priority for this feature)
|
|
242
|
+
for (const pattern of patterns.ambiguous) {
|
|
243
|
+
if (pattern.test(lowerName)) {
|
|
244
|
+
return {
|
|
245
|
+
category: "ambiguous",
|
|
246
|
+
pattern: pattern.source,
|
|
247
|
+
confidence: "low",
|
|
248
|
+
isAmbiguous: true,
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
// Check destructive patterns (high confidence)
|
|
253
|
+
for (const pattern of patterns.destructive) {
|
|
254
|
+
if (pattern.test(lowerName)) {
|
|
255
|
+
return {
|
|
256
|
+
category: "destructive",
|
|
257
|
+
pattern: pattern.source,
|
|
258
|
+
confidence: "high",
|
|
259
|
+
isAmbiguous: false,
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
// Check read-only patterns (high confidence)
|
|
264
|
+
for (const pattern of patterns.readOnly) {
|
|
265
|
+
if (pattern.test(lowerName)) {
|
|
266
|
+
return {
|
|
267
|
+
category: "readOnly",
|
|
268
|
+
pattern: pattern.source,
|
|
269
|
+
confidence: "high",
|
|
270
|
+
isAmbiguous: false,
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
// Check write patterns (medium confidence)
|
|
275
|
+
for (const pattern of patterns.write) {
|
|
276
|
+
if (pattern.test(lowerName)) {
|
|
277
|
+
return {
|
|
278
|
+
category: "write",
|
|
279
|
+
pattern: pattern.source,
|
|
280
|
+
confidence: "medium",
|
|
281
|
+
isAmbiguous: false,
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
// No pattern match
|
|
286
|
+
return {
|
|
287
|
+
category: "unknown",
|
|
288
|
+
pattern: null,
|
|
289
|
+
confidence: "low",
|
|
290
|
+
isAmbiguous: true,
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Singleton instance of compiled default patterns for performance.
|
|
295
|
+
*/
|
|
296
|
+
let defaultCompiledPatterns = null;
|
|
297
|
+
/**
|
|
298
|
+
* Get compiled default patterns (cached for performance).
|
|
299
|
+
*/
|
|
300
|
+
export function getDefaultCompiledPatterns() {
|
|
301
|
+
if (!defaultCompiledPatterns) {
|
|
302
|
+
defaultCompiledPatterns = compilePatterns(DEFAULT_ANNOTATION_PATTERNS);
|
|
303
|
+
}
|
|
304
|
+
return defaultCompiledPatterns;
|
|
305
|
+
}
|
|
@@ -12,8 +12,9 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { BaseAssessor } from "./BaseAssessor.js";
|
|
14
14
|
import { AssessmentContext } from "../AssessmentOrchestrator.js";
|
|
15
|
-
import type { ToolAnnotationAssessment, ToolAnnotationResult } from "../../../lib/assessmentTypes.js";
|
|
15
|
+
import type { ToolAnnotationAssessment, ToolAnnotationResult, AssessmentConfiguration } from "../../../lib/assessmentTypes.js";
|
|
16
16
|
import type { ClaudeCodeBridge } from "../lib/claudeCodeBridge.js";
|
|
17
|
+
import { type CompiledPatterns } from "../config/annotationPatterns.js";
|
|
17
18
|
/**
|
|
18
19
|
* Enhanced tool annotation result with Claude inference
|
|
19
20
|
*/
|
|
@@ -43,6 +44,12 @@ export interface EnhancedToolAnnotationAssessment extends ToolAnnotationAssessme
|
|
|
43
44
|
}
|
|
44
45
|
export declare class ToolAnnotationAssessor extends BaseAssessor {
|
|
45
46
|
private claudeBridge?;
|
|
47
|
+
private compiledPatterns;
|
|
48
|
+
constructor(config: AssessmentConfiguration);
|
|
49
|
+
/**
|
|
50
|
+
* Set custom compiled patterns for behavior inference
|
|
51
|
+
*/
|
|
52
|
+
setPatterns(patterns: CompiledPatterns): void;
|
|
46
53
|
/**
|
|
47
54
|
* Set Claude Code Bridge for enhanced behavior inference
|
|
48
55
|
*/
|
|
@@ -69,11 +76,18 @@ export declare class ToolAnnotationAssessor extends BaseAssessor {
|
|
|
69
76
|
private generateEnhancedRecommendations;
|
|
70
77
|
/**
|
|
71
78
|
* Assess a single tool's annotations
|
|
79
|
+
* Now includes alignment status with confidence-aware logic
|
|
72
80
|
*/
|
|
73
81
|
private assessTool;
|
|
74
82
|
/**
|
|
75
83
|
* Extract annotations from a tool
|
|
76
84
|
* MCP SDK may have annotations in different locations
|
|
85
|
+
*
|
|
86
|
+
* Priority order:
|
|
87
|
+
* 1. tool.annotations (MCP 2024-11 spec) - "mcp" source
|
|
88
|
+
* 2. Direct properties on tool - "mcp" source
|
|
89
|
+
* 3. tool.metadata - "mcp" source
|
|
90
|
+
* 4. No annotations found - "none" source
|
|
77
91
|
*/
|
|
78
92
|
private extractAnnotations;
|
|
79
93
|
/**
|
|
@@ -82,12 +96,18 @@ export declare class ToolAnnotationAssessor extends BaseAssessor {
|
|
|
82
96
|
private extractToolParams;
|
|
83
97
|
/**
|
|
84
98
|
* Infer expected behavior from tool name and description
|
|
99
|
+
* Now returns confidence level and ambiguity flag for better handling
|
|
85
100
|
*/
|
|
86
101
|
private inferBehavior;
|
|
87
102
|
/**
|
|
88
|
-
* Determine overall status
|
|
103
|
+
* Determine overall status using alignment status.
|
|
104
|
+
* Only MISALIGNED counts as failure; REVIEW_RECOMMENDED does not fail.
|
|
89
105
|
*/
|
|
90
106
|
private determineAnnotationStatus;
|
|
107
|
+
/**
|
|
108
|
+
* Calculate metrics and alignment breakdown for the assessment
|
|
109
|
+
*/
|
|
110
|
+
private calculateMetrics;
|
|
91
111
|
/**
|
|
92
112
|
* Generate explanation
|
|
93
113
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolAnnotationAssessor.d.ts","sourceRoot":"","sources":["../../../../src/services/assessment/modules/ToolAnnotationAssessor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EACV,wBAAwB,EACxB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"ToolAnnotationAssessor.d.ts","sourceRoot":"","sources":["../../../../src/services/assessment/modules/ToolAnnotationAssessor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EACV,wBAAwB,EACxB,oBAAoB,EAKpB,uBAAuB,EAExB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,8BAA8B,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,4BAA6B,SAAQ,oBAAoB;IACxE,eAAe,CAAC,EAAE;QAChB,gBAAgB,EAAE,OAAO,CAAC;QAC1B,mBAAmB,EAAE,OAAO,CAAC;QAC7B,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,oBAAoB,EAAE;YACpB,YAAY,CAAC,EAAE,OAAO,CAAC;YACvB,eAAe,CAAC,EAAE,OAAO,CAAC;YAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;SAC1B,CAAC;QACF,oBAAoB,EAAE,OAAO,CAAC;QAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B,MAAM,EAAE,iBAAiB,GAAG,eAAe,CAAC;KAC7C,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,gCAAiC,SAAQ,wBAAwB;IAChF,WAAW,EAAE,4BAA4B,EAAE,CAAC;IAC5C,cAAc,EAAE,OAAO,CAAC;IACxB,2BAA2B,EAAE,4BAA4B,EAAE,CAAC;CAC7D;AAKD,qBAAa,sBAAuB,SAAQ,YAAY;IACtD,OAAO,CAAC,YAAY,CAAC,CAAmB;IACxC,OAAO,CAAC,gBAAgB,CAAmB;gBAE/B,MAAM,EAAE,uBAAuB;IAM3C;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI;IAK7C;;OAEG;IACH,eAAe,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI;IAK/C;;OAEG;IACH,eAAe,IAAI,OAAO;IAO1B;;OAEG;IACG,MAAM,CACV,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,wBAAwB,GAAG,gCAAgC,CAAC;IA8QvE;;OAEG;YACW,0BAA0B;IA+IxC;;OAEG;IACH,OAAO,CAAC,2BAA2B;IAiCnC;;OAEG;IACH,OAAO,CAAC,+BAA+B;IAoFvC;;;OAGG;IACH,OAAO,CAAC,UAAU;IA+GlB;;;;;;;;;OASG;IACH,OAAO,CAAC,kBAAkB;IAyE1B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAuBzB;;;OAGG;IACH,OAAO,CAAC,aAAa;IAgGrB;;;OAGG;IACH,OAAO,CAAC,yBAAyB;IAkDjC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAiDxB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAmC3B;;OAEG;IACH,OAAO,CAAC,uBAAuB;CA2ChC"}
|