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

Method autoRegisterComponents

src/agent/Agent.ts:901–926  ·  view source on GitHub ↗

* 自动注册默认组件

()

Source from the content-addressed store, hash-verified

899 * 自动注册默认组件
900 */
901 private autoRegisterComponents(): void {
902 // 注册工具组件
903 if (this.config.tools?.enabled) {
904 const toolConfig = {
905 includeBuiltinTools: this.config.tools.includeBuiltinTools ?? true,
906 excludeTools: this.config.tools.excludeTools,
907 includeCategories: this.config.tools.includeCategories,
908 debug: this.config.debug,
909 };
910
911 const toolComponent = new ToolComponent('tools', toolConfig);
912 this.componentManager.registerComponent(toolComponent);
913 }
914
915 // 注册上下文组件
916 if (this.config.context?.enabled) {
917 const contextComponent = new ContextComponent('context', this.config.context);
918 this.componentManager.registerComponent(contextComponent);
919 }
920
921 // 注册 MCP 组件
922 if (this.config.mcp?.enabled) {
923 const mcpComponent = new MCPComponent('mcp', this.config.mcp);
924 this.componentManager.registerComponent(mcpComponent);
925 }
926 }
927
928 /**
929 * 设置管理器事件转发

Callers 1

constructorMethod · 0.95

Calls 1

registerComponentMethod · 0.45

Tested by

no test coverage detected