Skip to content

fix: clear() wiping dynamically registered tools by tracking discovered state on references#251

Open
soyuka wants to merge 1 commit intomodelcontextprotocol:mainfrom
soyuka:fix/clear
Open

fix: clear() wiping dynamically registered tools by tracking discovered state on references#251
soyuka wants to merge 1 commit intomodelcontextprotocol:mainfrom
soyuka:fix/clear

Conversation

@soyuka
Copy link
Contributor

@soyuka soyuka commented Mar 4, 2026

clear() previously removed all non-manual elements, which destroyed dynamically registered tools when setDiscoveryState() was called on the next request cycle. Add isDiscovered flag to ElementReference so clear() only removes elements that were imported via setDiscoveryState(), preserving both manual and dynamic registrations.

@soyuka soyuka force-pushed the fix/clear branch 2 times, most recently from 01d2107 to 8e7853b Compare March 4, 2026 19:39
…ed state on references

clear() previously removed all non-manual elements, which destroyed
dynamically registered tools when setDiscoveryState() was called on
the next request cycle. Add isDiscovered flag to ElementReference so
clear() only removes elements that were imported via setDiscoveryState(),
preserving both manual and dynamic registrations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant