MCP::Resource(3)

πŸ“¦
version 0.150.0 Β· 2 versions
, in opensuse-leap 16.0

✨ 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 with my $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