Register an ephemeral tool the host/model can call while this component is mounted.
Registration is synchronous against the runtime-owned App and independent
of connection completion. It is keyed by name only ([runtime, name]):
the tool registers once per mounted name and is removed on unmount. Changing
inputSchema / outputSchema without changing name does not
re-register — schemas are captured at registration time (ext-apps fixes
handler arity at registration); to change a tool's schema, register it under
a new name. schema is accepted as an alias for inputSchema.
title, description, and annotations changes are applied in place via
the ext-apps handle's update(), passing explicit undefined so omitted
fields are cleared. Toggling enabled calls enable() / disable()
without re-registering. The handler is kept in a ref so calls always see
current React state. Registration goes through the document runtime rather
than the guest App directly, allowing the runtime to perform the
empty-handler handoff on first registration.
Cleanup captures the registration handle inside the effect so an older
cleanup cannot remove a newer registration (e.g. after a rapid name
change). Registration failures are reported with console.error and do not
leave half-registered state.
Register an ephemeral tool the host/model can call while this component is mounted.
Registration is synchronous against the runtime-owned App and independent of connection completion. It is keyed by
nameonly ([runtime, name]): the tool registers once per mounted name and is removed on unmount. ChanginginputSchema/outputSchemawithout changingnamedoes not re-register — schemas are captured at registration time (ext-apps fixes handler arity at registration); to change a tool's schema, register it under a new name.schemais accepted as an alias forinputSchema.title,description, andannotationschanges are applied in place via the ext-apps handle'supdate(), passing explicitundefinedso omitted fields are cleared. Togglingenabledcallsenable()/disable()without re-registering. The handler is kept in a ref so calls always see current React state. Registration goes through the document runtime rather than the guest App directly, allowing the runtime to perform the empty-handler handoff on first registration.Cleanup captures the registration handle inside the effect so an older cleanup cannot remove a newer registration (e.g. after a rapid
namechange). Registration failures are reported withconsole.errorand do not leave half-registered state.