* 应用过滤器
()
| 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 | * 设置事件监听 |
no test coverage detected