MCP::Se...cription(3)

πŸ“¦ version 0.150.0, in opensuse-leap 16.0

✨ NAME ✨

MCP::Server::Subscription β€” it's literally a subscription container, bestie πŸ’… like this is the whole page, this is the manual for MCP::Server::Subscription in the User Contributed Perl Documentation section 3, and it's lowkey iconic.


🌸 SYNOPSIS 🌸

use MCP::Server::Subscription;

my $subscription = MCP::Server::Subscription->new(id => 1, notifications => {toolsListChanged => 1});
my $bool         = $subscription->wants('notifications/tools/list_changed');

Look at that. Two lines and you're already living your best life 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

MCP::Server::Subscription is a container for a "subscriptions/listen" notification stream. That's it, that's the vibe β€” it holds the stream, it doesn't overthink it ✨


πŸŽ€ ATTRIBUTES πŸŽ€

MCP::Server::Subscription implements the following attributes, and yes we're going through all of them, no skipping, periodt.

πŸ“ id

my $id        = $subscription->id;
$subscription = $subscription->id(1);

The JSON-RPC id of the "subscriptions/listen" request that opened this subscription, sent to the client as "_meta.io.modelcontextprotocol/subscriptionId" with every message on the stream. So every single message carries its little name tag 🏷️ iykyk.

⭐ notifications

my $filter    = $subscription->notifications;
$subscription = $subscription->notifications({toolsListChanged => 1});

The notification filter the client requested, as a hash reference. Notification types that were not requested are never delivered β€” no surprise notifications, we respect boundaries here πŸš«πŸ’Œ

🌈 stream

my $stream    = $subscription->stream;
$subscription = $subscription->stream(Mojolicious::Controller->new);

The Mojolicious::Controller serving the SSE stream for this subscription, when the HTTP transport is in use. Main character energy for the controller fr fr πŸ‘‘


πŸ’– METHODS πŸ’–

MCP::Server::Subscription inherits all methods from Mojo::Base and implements the following new ones. Inheriting from Mojo::Base? We love a nepo baby with actual talent πŸ’…

🧚 acknowledgement

my $notification = $subscription->acknowledgement;

The "notifications/subscriptions/acknowledged" notification a server has to send as the very first message on a subscription stream, listing the notification types it will actually deliver. Very first β€” like, first-message-first, don't be weird about it πŸ™ˆ

πŸ”₯ honoured

my $filter = $subscription->honoured;

The subset of "notifications" the server actually supports. It's giving "we hear you but we can't give you everything" bestie 😭

πŸ‘‘ notification

my $notification = $subscription->notification($method);
my $notification = $subscription->notification($method, {foo => 'bar'});

Build a JSON-RPC notification for this subscription, tagged with "id" in "_meta.io.modelcontextprotocol/subscriptionId". Same name tag as before, consistency is the moment πŸŽ€

🌸 wants

my $bool = $subscription->wants('notifications/tools/list_changed');

Returns true if the given notification method was requested in "notifications". A simple yes/no, a vibe check if you will βœ…


πŸ”— SEE ALSO πŸ”—


ok that's the whole page bestie, go build something iconic with it πŸŒˆπŸ’œ

Signed, sealed, delivered β€” straight from perl v5.42.0, dated 2026-07-31, and it's still MCP::Se...cription(3). Slay πŸ’…βœ¨

πŸ“¦ where this page comes from