MCP::Resource(3)
β¨ MCP::Resource β¨
okay so bestie, this page lives in the User Contributed Perl Documentation section of your man pages (iykyk, the (3) bit is literally that), and it's about a lil container class called MCP::Resource. buckle up, it's short and sweet and honestly kind of a slay π
πΈ NAME πΈ
MCP::Resource β it's a resource container. that's the whole vibe. a box. for resources. π
π¦ SYNOPSIS π¦
here's the whole entire usage, no cap:
use MCP::Resource;
my $resource = MCP::Resource->new;
load it, new it up, boom. you're in. β¨
π DESCRIPTION π
MCP::Resource is a container for resources. literally, that's the official description and it's giving minimal queen energy π
π ATTRIBUTES π
MCP::Resource implements the following attributes, and they're all exactly the same deal: call them with no args to read, call them with a value to set. dual threat, main character behaviour fr fr π
codeβ this is the resource code. get it withmy $code = $resource->code;or set it with a sub, like$resource = $resource->code(sub { ... });π§descriptionβ the description of the resource, duh.my $description = $resource->description;to read it,$resource = $resource->description('A brief description of the resource');to set it π«Άmime_typeβ the MIME type of the resource.my $mime_type = $resource->mime_type;or$resource = $resource->mime_type('text/plain');β she's picky about her types πnameβ the name of the resource.my $name = $resource->name;/$resource = $resource->name('my_resource');πuriβ the URI of the resource.my $uri = $resource->uri;/$resource = $resource->uri('file:///path/to/resource.txt');maybe she's a file, maybe she's a vibe, who's to say πΈ
π₯ METHODS π₯
MCP::Resource inherits all methods from MCP::Primitive (yup, she's got a whole family tree) and implements the following new ones β these are the homegrown ones, the ones that are hers π
β binary_resource
my $result = $resource->binary_resource($data);
Returns a binary resource in the expected format. that's it, that's the method. binary bestie behaviour π
β call
my $result = $resource->call($context);
Calls the resource with context, returning a result. and listen β the result can be a promise or a direct value, so don't be weird about it, she's flexible like that π
β text_resource
my $result = $resource->text_resource('Some text');
Returns a text resource in the expected format. text girlies, this one's for you π
π SEE ALSO π
go touch grass in these places, they're all iconic:
bestie heads up: every character above is load-bearing, so if you're typing these out, keep the flags, paths and snippets exactly as written π
and that's the whole page!! mwah π this was perl v5.42.0, dated 2026-07-31, and you were reading MCP::Resource(3) β go forth and containerise your resources, queen ππ
β¨
π¦ 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