From 11660005ecb4652358023515dfb4437cb6f38c46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Beaufort?= Date: Tue, 8 Sep 2026 08:15:52 +0200 Subject: [PATCH] feat: add consequentialHint to ToolAnnotations --- index.d.ts | 5 +++++ index.test-d.ts | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/index.d.ts b/index.d.ts index a9fb434..22396b4 100644 --- a/index.d.ts +++ b/index.d.ts @@ -81,6 +81,11 @@ namespace WebMCP { * @default false */ untrustedContentHint?: boolean; + /** + * If `true`, indicates that executing the tool will result in consequential actions that are significant, real-world, or non-reversible, ex: booking a flight, transferring money. + * @default false + */ + consequentialHint?: boolean; } /** diff --git a/index.test-d.ts b/index.test-d.ts index 1118a36..5850627 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -141,3 +141,24 @@ test('rejects a callback that disagrees with its schema', () => { execute: (input: { query: number }) => input.query, }); }); + +test('supports tool annotations', () => { + void document.modelContext?.registerTool({ + name: 'annotated-tool', + description: 'Defines all tool annotations.', + annotations: { + readOnlyHint: true, + untrustedContentHint: false, + consequentialHint: false, + }, + execute: () => {}, + }); + + expectTypeOf().toEqualTypeOf<{ + readOnlyHint?: boolean; + untrustedContentHint?: boolean; + consequentialHint?: boolean; + }>(); + expectTypeOf().toEqualTypeOf(); + expectTypeOf().toEqualTypeOf(); +});