From 29a2d403da7b6f0757654f25c982b9f4f8514395 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 28 Nov 2025 15:46:48 +0100 Subject: [PATCH] Allow calling internal methods also as notifications --- internal/msgpackrouter/router.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/msgpackrouter/router.go b/internal/msgpackrouter/router.go index 811b1cd..e570095 100644 --- a/internal/msgpackrouter/router.go +++ b/internal/msgpackrouter/router.go @@ -129,6 +129,13 @@ func (r *Router) connectionLoop(conn io.ReadWriteCloser) { // This handler is called when a notification is received from the client slog.Debug("Received notification", "method", method, "params", params) + // Check if the method is an internal method + if handler, ok := r.routesInternal[method]; ok { + // call the internal method handler (since it's a notification, discard the result) + _, _ = handler(context.Background(), msgpackconn, params) + return + } + // Check if the method is registered client, ok := r.getConnectionForMethod(method) if !ok {