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

Method applyFilters

src/agent/ToolComponent.ts:257–284  ·  view source on GitHub ↗

* 应用过滤器

()

Source from the content-addressed store, hash-verified

255 * 应用过滤器
256 */
257 private applyFilters(): void {
258 if (!this.toolManager) {
259 return;
260 }
261
262 const { excludeTools, includeCategories } = this.config;
263
264 // 排除指定工具
265 if (excludeTools && excludeTools.length > 0) {
266 for (const toolName of excludeTools) {
267 if (this.toolManager.hasTool(toolName)) {
268 this.toolManager.unregisterTool(toolName);
269 this.log(`已排除工具: ${toolName}`);
270 }
271 }
272 }
273
274 // 仅包含指定分类
275 if (includeCategories && includeCategories.length > 0) {
276 const tools = this.toolManager.getTools();
277 for (const tool of tools) {
278 if (!includeCategories.includes(tool.category || 'other')) {
279 this.toolManager.unregisterTool(tool.name);
280 this.log(`已排除分类 "${tool.category}" 的工具: ${tool.name}`);
281 }
282 }
283 }
284 }
285
286 /**
287 * 设置事件监听

Callers 1

initMethod · 0.95

Calls 4

logMethod · 0.95
hasToolMethod · 0.80
unregisterToolMethod · 0.80
getToolsMethod · 0.45

Tested by

no test coverage detected