From b90e29dba12c5a2dd4c31f8ea8a2c13f6a80be9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Beaufort?= Date: Mon, 17 Aug 2026 15:37:00 +0200 Subject: [PATCH] feat: add executeTool() method --- index.d.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/index.d.ts b/index.d.ts index 95a98f7..d9d305c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -95,6 +95,16 @@ declare namespace WebMCP { fromOrigins?: string[]; } + /** + * Options for executing a tool. + */ + interface ModelContextExecuteToolOptions { + /** + * An AbortSignal that can be used to cancel the execution of the tool. + */ + signal?: AbortSignal; + } + /** * Represents a tool that has been registered and is available for execution. */ @@ -149,6 +159,13 @@ declare namespace WebMCP { * @param options Filtering options. */ getTools(options?: ModelContextGetToolOptions): Promise; + /** + * Executes a tool on the document it was registered on. + * @param tool The tool to execute. + * @param inputObject The input parameters for the tool. + * @param options Execution options. + */ + executeTool(tool: RegisteredTool, inputObject?: object, options?: ModelContextExecuteToolOptions): Promise; /** * Event handler for the toolchange event. */