/
githubmirror
/
angular
Обзор
Документация
Войти
/
githubmirror
/
angular
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/core/src/webmcp/provide_tools.ts
37 строк
1 KB
Alex Rickabaugh
refactor: add g3-only and 3p-only markers to replace specific g3 patches
27 май 2026, 02:09
27 май 2026, 02:09
4f9ee3c
Код
Авторство
О чём код?
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ // g3-only import type {JsonSchemaForInference} from '@mcp-b/webmcp-types'; import type {JsonSchemaForInference} from '../../third_party/@mcp-b/webmcp-types'; // 3p-only import {EnvironmentProviders, makeEnvironmentProviders, provideEnvironmentInitializer} from '../di'; import {declareExperimentalWebMcpTool} from './declare_tool'; import type {ToolDescriptor} from './types'; /** * Provides a list of WebMCP tools tied to the lifecycle of the associated `Injector`. * * The tools are automatically registered when the environment is initialized * and unregistered when the associated injector is destroyed. * * The `tools[number].execute` function is invoked in the injection context of the * associated `Injector`. * * @param tools The tools to register and execute when invoked by an AI agent. * @returns An {@link EnvironmentProviders} that can be used in `bootstrapApplication` * or route providers. * @experimental */ export function provideExperimentalWebMcpTools<const InputSchema extends JsonSchemaForInference>( tools: ToolDescriptor<InputSchema>[], ): EnvironmentProviders { return makeEnvironmentProviders([ provideEnvironmentInitializer(() => { for (const tool of tools) declareExperimentalWebMcpTool(tool); }), ]); }