Add auto-subscription for real-time message notifications
- ReceiveMessagesTool subscription activates automatically on startup - No need to call receive_messages manually first - Messages arrive in real-time like chat - Notifications appear instantly when messages sent 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,21 @@ export class ToolRegistry {
|
|||||||
|
|
||||||
async initialize(): Promise<void> {
|
async initialize(): Promise<void> {
|
||||||
this.setupDiscovery();
|
this.setupDiscovery();
|
||||||
|
await this.setupMessageSubscription();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async setupMessageSubscription(): Promise<void> {
|
||||||
|
// Auto-activate receive_messages subscription for real-time notifications
|
||||||
|
const receiveMessagesTool = this.builtinHandlers.get('receive_messages');
|
||||||
|
if (receiveMessagesTool) {
|
||||||
|
try {
|
||||||
|
// Trigger initial subscription by calling the tool with empty params
|
||||||
|
await this.executeBuiltinTool(receiveMessagesTool, {});
|
||||||
|
logger.info('Message subscription activated for real-time notifications');
|
||||||
|
} catch (error) {
|
||||||
|
logger.warn({ error }, 'Failed to auto-activate message subscription');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private setupDiscovery(): void {
|
private setupDiscovery(): void {
|
||||||
|
|||||||
Reference in New Issue
Block a user