MCPcopy Create free account
hub / github.com/echoVic/blade-code / getStats

Method getStats

src/tools/ToolManager.ts:285–312  ·  view source on GitHub ↗

* 获取工具统计信息

()

Source from the content-addressed store, hash-verified

283 * 获取工具统计信息
284 */
285 public getStats(): Record<string, any> {
286 const stats = {
287 totalTools: this.tools.size,
288 enabledTools: 0,
289 runningExecutions: this.runningExecutions.size,
290 totalExecutions: this.executionHistory.length,
291 successfulExecutions: 0,
292 failedExecutions: 0,
293 };
294
295 // 统计启用的工具
296 for (const state of this.toolStates.values()) {
297 if (state.enabled) {
298 stats.enabledTools++;
299 }
300 }
301
302 // 统计执行结果
303 for (const history of this.executionHistory) {
304 if (history.result.success) {
305 stats.successfulExecutions++;
306 } else {
307 stats.failedExecutions++;
308 }
309 }
310
311 return stats;
312 }
313
314 /**
315 * 验证工具定义

Callers 1

statsExampleFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected