Sitelet https://github.com/webmachinelearning/webmcp/issues/332
Skip to content

Fire toolactivated after invoking execute #332

Description

@beaufortfrancois

The imperative execute steps fire toolactivated before invoking the tool's execute callback.

Chromium and WPT both do it the other way around:

Proposal: move the step after the call to execute, and add a guard:

 1. Let |toolPromise| be the result of [=invoke|invoking=] |tool|'s {{ModelContextTool/execute}} with
    |inputObject| and |options|.

+1. [=Fire an event=] named {{ModelContext/toolactivated}} at |targetDocument|'s [=Document/associated
+   ModelContext|associated <code>ModelContext</code>=], using {{ToolActivatedEvent}}, with its
+   {{ToolActivatedEvent/toolName}} attribute initialized to |tool|'s {{ModelContextTool/name}}.
+
 1. [=promise/React=] to |toolPromise|:

Related: #126, #245.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions