You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug #247 introduced the ability to mutate tools, prompts, and resources, but the way updating by name/uri works is buggy in that it captures the original identifier and continues using it, even if it's no longer the correct one. This means that updating e.g. a tool name more than once leads to incorrect behavior.
To Reproduce
Steps to reproduce the behavior:
Register a tool by name - let's say "Foo"
Call foo.update({ name: "Bar" }). This works well and we remove "Foo" from registered tools and add "Bar".
Call foo.update({ name: "Foo" }) - trying to return to the original name. This has no effect because the checkupdates.name !== name returns false, since name is the captured original name (Foo) rather than the current tool name (Bar).
Alternatively, if we call foo.update({ name: "Baz" }), we end up with calling delete this._registeredTools[name], which tries to delete Foo, which is anyway no longer present in _registeredTools, and then adds Baz, ending up with both Bar and Baz in the _registeredTools collection.
Expected behavior
Updating a tool/resource/prompt identifier should compare the new identifier to the current one, rather than the original one.
The text was updated successfully, but these errors were encountered:
Describe the bug
#247 introduced the ability to mutate tools, prompts, and resources, but the way updating by name/uri works is buggy in that it captures the original identifier and continues using it, even if it's no longer the correct one. This means that updating e.g. a tool name more than once leads to incorrect behavior.
To Reproduce
Steps to reproduce the behavior:
foo.update({ name: "Bar" })
. This works well and we remove"Foo"
from registered tools and add"Bar"
.foo.update({ name: "Foo" })
- trying to return to the original name. This has no effect because the checkupdates.name !== name
returns false, sincename
is the captured original name (Foo
) rather than the current tool name (Bar
).foo.update({ name: "Baz" })
, we end up with callingdelete this._registeredTools[name]
, which tries to deleteFoo
, which is anyway no longer present in_registeredTools
, and then addsBaz
, ending up with bothBar
andBaz
in the_registeredTools
collection.Expected behavior
Updating a tool/resource/prompt identifier should compare the new identifier to the current one, rather than the original one.
The text was updated successfully, but these errors were encountered: