MCP::Prompt(3)

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

πŸŽ€ MCP::Prompt β€” the prompt container bestie πŸ’…

okay so real talk: this is MCP::Prompt(3), a page from the User Contributed Perl Documentation, and it's genuinely just a container for prompts. iconic behavior, honestly. let's get into it ✨


🌸 SYNOPSIS 🌸

like, the bare minimum to get going:

use MCP::Prompt;

my $prompt = MCP::Prompt->new;

that's it. that's the whole vibe check. you made a prompt 🫢


πŸ’– DESCRIPTION πŸ’–

MCP::Prompt is a container for prompts. that's the whole description. she said what she said. no cap. πŸ’€


πŸ‘‘ ATTRIBUTES πŸ‘‘

MCP::Prompt implements the following attributes. every single one, we're covering all of them, no skipping πŸ“

⭐ arguments

my $args = $prompt->arguments;
$prompt   = $prompt->arguments([{name => 'foo', description => 'Whatever', required => 1}]);

Arguments for the prompt. literally what it says on the tin β€” you pass it an arrayref of hashes and it's like "okay noted". the example even shows off name, description and required so you know the shape of things πŸ’…

🌈 code

my $code = $prompt->code;
$prompt  = $prompt->code(sub { ... });

Prompt code. that's the code that does the prompt thing. you get it, you set it, you pass it a coderef. main character energy πŸ”₯

πŸ¦‹ description

my $description = $prompt->description;
$prompt         = $prompt->description('A brief description of the prompt');

Description of the prompt. yes bestie, a lil string that says what the prompt is about. a brief description of the prompt, if you will 😭

🧚 name

my $name = $prompt->name;
$prompt  = $prompt->name('my_prompt');

Name of the Prompt. capital P on Prompt, love that for her. name your prompt my_prompt or honestly whatever, it's your world 🌸


πŸ’œ METHODS πŸ’œ

MCP::Prompt inherits all methods from MCP::Primitive (so go read that one too, iykyk) and implements the following new ones πŸ‘‡

πŸ’« call

my $result = $prompt->call($args, $context);

Calls the prompt with the given arguments and context, returning a result. and here's the fun part β€” the result can be a promise or a direct value. so it might hand you a thing right away, or it might hand you a promise of a thing. both are valid, don't panic 🫢

πŸ”₯ text_prompt

my $result = $prompt->text_prompt('Some text');
my $result = $prompt->text_prompt('Some text', $role);
my $result = $prompt->text_prompt('Some text', $role, $description);

Returns a text prompt in the expected format. the expected format!! three whole ways to call it β€” just text, text plus a $role, or text plus a $role plus a $description. pick your fighter ✨

πŸŽ€ validate_input

my $bool = $prompt->validate_input($args);

Validates the input arguments. Returns true if validation failed. yes babes, read that again β€” true means it FAILED. it's a "did this go wrong" flag, not a "did this go right" flag. do not get got by this one πŸ™ˆ


πŸ¦‹ SEE ALSO πŸ¦‹

go click around, there's lore πŸ’–


and that's the whole page, bestie! this lil beauty is perl v5.42.0, dated 2026-07-31, from the MCP::Prompt(3) section of the User Contributed Perl Documentation. slay, read responsibly, mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from