• Overview
@angular/core

declareExperimentalWebMcpTool

function

Declares a WebMCP tool.

API

function declareExperimentalWebMcpTool<
  InputSchema extends JsonSchemaForInference,
>(tool: ToolDescriptor<InputSchema>, injector?: Injector | undefined): void;
@paramtoolToolDescriptor<InputSchema>

The tool to register and execute when invoked by an AI agent.

@paraminjectorInjector | undefined

Optional Injector which will automatically unregister the tool when destroyed. Defaults to the current injection context if not provided.

@returnsvoid

Description

Declares a WebMCP tool.

The tool is immediately registered and automatically unregistered when the associated injection context is destroyed.

The tool.execute function is invoked in the injection context of the provided Injector, or the injection context of declareExperimentalWebMcpTool itself.

Jump to details