fix: handle error when sending tool list changed notification (#13)

This commit is contained in:
samanhappy
2025-04-17 19:21:28 +08:00
committed by GitHub
parent adef02d3b9
commit 66d592da1c
2 changed files with 9 additions and 3 deletions

View File

@@ -16,4 +16,4 @@ jobs:
- name: Release
uses: softprops/action-gh-release@v2
with:
gen_release_notes: true
generate_release_notes: true

View File

@@ -27,8 +27,14 @@ export const getMcpServer = (): Server => {
export const notifyToolChanged = async () => {
await registerAllTools(currentServer, true);
currentServer.sendToolListChanged();
console.log('Tool list changed notification sent');
currentServer
.sendToolListChanged()
.catch((error) => {
console.error('Failed to send tool list changed notification:', error);
})
.then(() => {
console.log('Tool list changed notification sent successfully');
});
};
// Store all server information