MCP::Se...cription(3)
β¨ 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
- opensuse-leap 16.0: perl-MCP 0.150.0-bp160.1.1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms