Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package perl-MCP for openSUSE:Factory 
checked in at 2025-10-07 18:29:11
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-MCP (Old)
 and      /work/SRC/openSUSE:Factory/.perl-MCP.new.11973 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-MCP"

Tue Oct  7 18:29:11 2025 rev:2 rq:1309621 version:0.50.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-MCP/perl-MCP.changes        2025-09-02 
18:01:46.279194749 +0200
+++ /work/SRC/openSUSE:Factory/.perl-MCP.new.11973/perl-MCP.changes     
2025-10-07 18:31:35.093612886 +0200
@@ -1,0 +2,12 @@
+Mon Oct  6 18:47:59 UTC 2025 - Tina Müller <[email protected]>
+
+- updated to 0.50.0 (0.05)
+   see /usr/share/doc/packages/perl-MCP/Changes
+
+  0.05  2025-08-28
+    - Added supprot for prompts.
+    - Added MCP::Prompt class.
+    - Added get_prompt and list_pronmpts methods to MCP::Client.
+    - Added prompt method to MCP::Server.
+
+-------------------------------------------------------------------

Old:
----
  MCP-0.04.tar.gz

New:
----
  MCP-0.05.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-MCP.spec ++++++
--- /var/tmp/diff_new_pack.wtqkAx/_old  2025-10-07 18:31:35.901646934 +0200
+++ /var/tmp/diff_new_pack.wtqkAx/_new  2025-10-07 18:31:35.905647102 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package perl-MCP
 #
-# Copyright (c) 2025 SUSE LLC
+# Copyright (c) 2025 SUSE LLC and contributors
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,14 +18,14 @@
 
 %define cpan_name MCP
 Name:           perl-MCP
-Version:        0.40.0
+Version:        0.50.0
 Release:        0
-# 0.04 -> normalize -> 0.40.0
-%define cpan_version 0.04
+# 0.05 -> normalize -> 0.50.0
+%define cpan_version 0.05
 License:        MIT
 Summary:        Connect Perl with AI using MCP (Model Context Protocol)
 URL:            https://metacpan.org/release/%{cpan_name}
-Source0:        MCP-0.04.tar.gz
+Source0:        
https://cpan.metacpan.org/authors/id/S/SR/SRI/%{cpan_name}-%{cpan_version}.tar.gz
 Source100:      README.md
 BuildArch:      noarch
 BuildRequires:  perl
@@ -41,6 +41,7 @@
 Provides:       perl(MCP) = %{version}
 Provides:       perl(MCP::Client)
 Provides:       perl(MCP::Constants)
+Provides:       perl(MCP::Prompt)
 Provides:       perl(MCP::Server)
 Provides:       perl(MCP::Server::Transport)
 Provides:       perl(MCP::Server::Transport::HTTP)
@@ -51,9 +52,9 @@
 
 %description
 Connect Perl with AI using the Model Context Protocol (MCP). Currently this
-module is focused on tool calling, but it will be extended to support other
-MCP features in the future. At its core, MCP is all about text processing,
-making it a great fit for Perl.
+module is focused on tool calling and prompts, but it will be extended to
+support other MCP features in the future. At its core, MCP is all about
+text processing, making it a great fit for Perl.
 
 Streamable HTTP Transport
     Use the MCP::Server/"to_action" method to add an MCP endpoint to any

++++++ MCP-0.04.tar.gz -> MCP-0.05.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MCP-0.04/Changes new/MCP-0.05/Changes
--- old/MCP-0.04/Changes        2025-08-04 14:44:04.845593946 +0200
+++ new/MCP-0.05/Changes        2025-08-28 15:15:26.976650928 +0200
@@ -1,4 +1,10 @@
 
+0.05  2025-08-28
+  - Added supprot for prompts.
+  - Added MCP::Prompt class.
+  - Added get_prompt and list_pronmpts methods to MCP::Client.
+  - Added prompt method to MCP::Server.
+
 0.04  2025-08-04
   - Added support for structured content.
   - Added output_schema attribute to MCP::Tool.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MCP-0.04/MANIFEST new/MCP-0.05/MANIFEST
--- old/MCP-0.04/MANIFEST       2025-08-04 15:10:32.531542981 +0200
+++ new/MCP-0.05/MANIFEST       2025-08-28 16:07:39.780347064 +0200
@@ -5,6 +5,7 @@
 lib/MCP.pm
 lib/MCP/Client.pm
 lib/MCP/Constants.pm
+lib/MCP/Prompt.pm
 lib/MCP/Server.pm
 lib/MCP/Server/Transport.pm
 lib/MCP/Server/Transport/HTTP.pm
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MCP-0.04/META.json new/MCP-0.05/META.json
--- old/MCP-0.04/META.json      2025-08-04 15:10:32.507334586 +0200
+++ new/MCP-0.05/META.json      2025-08-28 16:07:39.756648793 +0200
@@ -61,6 +61,6 @@
          "web" : "https://web.libera.chat/#mojo";
       }
    },
-   "version" : "0.04",
+   "version" : "0.05",
    "x_serialization_backend" : "JSON::PP version 4.16"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MCP-0.04/META.yml new/MCP-0.05/META.yml
--- old/MCP-0.04/META.yml       2025-08-04 15:10:32.389674434 +0200
+++ new/MCP-0.05/META.yml       2025-08-28 16:07:39.642666757 +0200
@@ -33,5 +33,5 @@
   homepage: https://mojolicious.org
   license: http://www.opensource.org/licenses/mit
   repository: https://github.com/mojolicious/mojo-mcp.git
-version: '0.04'
+version: '0.05'
 x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MCP-0.04/README.md new/MCP-0.05/README.md
--- old/MCP-0.04/README.md      2025-08-01 17:14:28.545427326 +0200
+++ new/MCP-0.05/README.md      2025-08-28 15:17:13.050503901 +0200
@@ -11,12 +11,20 @@
 Please be aware that this module is still in development and will be changing 
rapidly. Additionally the MCP
 specification is getting regular updates which we will implement. Breaking 
changes are very likely.
 
-  * Tool calling
+  * Tool calling and prompts
   * Streamable HTTP and Stdio transports
   * Scalable with pre-forking web server and async tools using promises
   * HTTP client for testing
   * Can be embedded in Mojolicious web apps
 
+## Installation
+
+  All you need is Perl 5.20 or newer. Just install from 
[CPAN](https://metacpan.org/pod/MCP).
+
+    $ cpanm -n MCP
+
+  We recommend the use of a [Perlbrew](http://perlbrew.pl) environment.
+
 ## Streamable HTTP Transport
 
 Use the `to_action` method to add an MCP endpoint to any Mojolicious 
application.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MCP-0.04/examples/echo_http.pl 
new/MCP-0.05/examples/echo_http.pl
--- old/MCP-0.04/examples/echo_http.pl  2025-08-01 11:41:27.221121004 +0200
+++ new/MCP-0.05/examples/echo_http.pl  2025-08-28 15:58:29.897984935 +0200
@@ -26,6 +26,13 @@
     return "Echo: $args->{msg}";
   }
 );
+$server->prompt(
+  name        => 'echo',
+  description => 'A prompt to demonstrate the echo tool',
+  code        => sub ($prompt, $args) {
+    return 'Use the echo tool with the message "Hello, World!"';
+  }
+);
 
 any '/mcp' => $server->to_action;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MCP-0.04/examples/echo_stdio.pl 
new/MCP-0.05/examples/echo_stdio.pl
--- old/MCP-0.04/examples/echo_stdio.pl 2025-08-01 00:24:36.964595372 +0200
+++ new/MCP-0.05/examples/echo_stdio.pl 2025-08-28 15:59:42.829790845 +0200
@@ -23,5 +23,12 @@
     return "Echo: $args->{msg}";
   }
 );
+$server->prompt(
+  name        => 'echo',
+  description => 'A prompt to demonstrate the echo tool',
+  code        => sub ($prompt, $args) {
+    return 'Use the echo tool with the message "Hello, World!"';
+  }
+);
 
 $server->to_stdio;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MCP-0.04/lib/MCP/Client.pm 
new/MCP-0.05/lib/MCP/Client.pm
--- old/MCP-0.04/lib/MCP/Client.pm      2025-08-01 18:05:31.882645390 +0200
+++ new/MCP-0.05/lib/MCP/Client.pm      2025-08-28 15:14:03.344105486 +0200
@@ -28,6 +28,11 @@
   return _result($self->send_request($request));
 }
 
+sub get_prompt ($self, $name, $args = {}) {
+  my $request = $self->build_request('prompts/get', {name => $name, arguments 
=> $args});
+  return _result($self->send_request($request));
+}
+
 sub initialize_session ($self) {
   my $request = $self->build_request(
     initialize => {
@@ -41,8 +46,9 @@
   return $result;
 }
 
-sub list_tools ($self) { 
_result($self->send_request($self->build_request('tools/list'))) }
-sub ping       ($self) { 
_result($self->send_request($self->build_request('ping'))) }
+sub list_prompts ($self) { 
_result($self->send_request($self->build_request('prompts/list'))) }
+sub list_tools   ($self) { 
_result($self->send_request($self->build_request('tools/list'))) }
+sub ping         ($self) { 
_result($self->send_request($self->build_request('ping'))) }
 
 sub send_request ($self, $request) {
   my $headers = {Accept => 'application/json, text/event-stream', 
'Content-Type' => 'application/json'};
@@ -167,12 +173,25 @@
 
 Calls a tool on the MCP server with the specified name and arguments, 
returning the result.
 
+=head2 get_prompt
+
+  my $result = $client->get_prompt('prompt_name');
+  my $result = $client->get_prompt('prompt_name', {arg1 => 'value1'});
+
+Get a prompt from the MCP server with the specified name and arguments, 
returning the result.
+
 =head2 initialize_session
 
   my $result = $client->initialize_session;
 
 Initializes a session with the MCP server, setting up the protocol version and 
client information.
 
+=head2 list_prompts
+
+  my $prompts = $client->list_prompts;
+
+Lists all available prompts on the MCP server.
+
 =head2 list_tools
 
   my $tools = $client->list_tools;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MCP-0.04/lib/MCP/Prompt.pm 
new/MCP-0.05/lib/MCP/Prompt.pm
--- old/MCP-0.04/lib/MCP/Prompt.pm      1970-01-01 01:00:00.000000000 +0100
+++ new/MCP-0.05/lib/MCP/Prompt.pm      2025-08-28 15:51:38.160637970 +0200
@@ -0,0 +1,127 @@
+package MCP::Prompt;
+use Mojo::Base -base, -signatures;
+
+use Scalar::Util qw(blessed);
+
+has arguments   => sub { [] };
+has code        => sub { die 'Prompt code not implemented' };
+has description => 'Generic MCP prompt';
+has name        => 'prompt';
+
+sub call ($self, $args, $context) {
+  local $self->{context} = $context;
+  my $result = $self->code->($self, $args);
+  return $result->then(sub { $self->_type_check($_[0]) }) if blessed($result) 
&& $result->isa('Mojo::Promise');
+  return $self->_type_check($result);
+}
+
+sub context ($self) { $self->{context} || {} }
+
+sub text_prompt ($self, $text, $role = 'user', $description = undef) {
+  my $result = {messages => [{role => $role, content => [{type => 'text', text 
=> "$text"}]}]};
+  $result->{description} = $description if defined $description;
+  return $result;
+}
+
+sub validate_input ($self, $args) {
+  for my $arg (@{$self->arguments}) {
+    next     unless $arg->{required};
+    return 1 unless exists $args->{$arg->{name}};
+  }
+  return 0;
+}
+
+sub _type_check ($self, $result) {
+  return $result if ref $result eq 'HASH' && exists $result->{messages};
+  return $self->text_prompt($result);
+}
+
+1;
+
+=encoding utf8
+
+=head1 NAME
+
+MCP::Prompt - Prompt container
+
+=head1 SYNOPSIS
+
+  use MCP::Prompt;
+
+  my $prompt = MCP::Prompt->new;
+
+=head1 DESCRIPTION
+
+L<MCP::Prompt> is a container for prompts.
+
+=head1 ATTRIBUTES
+
+L<MCP::Prompt> implements the following attributes.
+
+=head2 arguments
+
+  my $args = $prompt->arguments;
+  $prompt   = $prompt->arguments([{name => 'foo', description => 'Whatever', 
required => 1}]);
+
+Arguments for the prompt.
+
+=head2 code
+
+  my $code = $prompt->code;
+  $prompt  = $prompt->code(sub { ... });
+
+Prompt code.
+
+=head2 description
+
+  my $description = $prompt->description;
+  $prompt         = $prompt->description('A brief description of the prompt');
+
+Description of the prompt.
+
+=head2 name
+
+  my $name = $prompt->name;
+  $prompt  = $prompt->name('my_prompt');
+
+Name of the Prompt.
+
+=head1 METHODS
+
+L<MCP::Prompt> inherits all methods from L<Mojo::Base> and implements the 
following new ones.
+
+=head2 call
+
+  my $result = $prompt->call($args, $context);
+
+Calls the prompt with the given arguments and context, returning a result. The 
result can be a promise or a direct
+value.
+
+=head2 context
+
+  my $context = $prompt->context;
+
+Returns the context in which the prompt is executed.
+
+  # Get controller for requests using the HTTP transport
+  my $c = $prompt->context->{controller};
+
+=head2 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.
+
+=head2 validate_input
+
+  my $bool = $prompt->validate_input($args);
+
+Validates the input arguments. Returns true if validation failed.
+
+=head1 SEE ALSO
+
+L<MCP>, L<https://mojolicious.org>, L<https://modelcontextprotocol.io>.
+
+=cut
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MCP-0.04/lib/MCP/Server.pm 
new/MCP-0.05/lib/MCP/Server.pm
--- old/MCP-0.04/lib/MCP/Server.pm      2025-08-04 14:47:15.646949073 +0200
+++ new/MCP-0.05/lib/MCP/Server.pm      2025-08-28 16:03:20.743712599 +0200
@@ -4,13 +4,15 @@
 use List::Util     qw(first);
 use Mojo::JSON     qw(false true);
 use MCP::Constants qw(INVALID_PARAMS INVALID_REQUEST METHOD_NOT_FOUND 
PARSE_ERROR PROTOCOL_VERSION);
+use MCP::Prompt;
 use MCP::Server::Transport::HTTP;
 use MCP::Server::Transport::Stdio;
 use MCP::Tool;
 use Scalar::Util qw(blessed);
 
-has name  => 'PerlServer';
-has tools => sub { [] };
+has name    => 'PerlServer';
+has prompts => sub { [] };
+has tools   => sub { [] };
 has 'transport';
 has version => '1.0.0';
 
@@ -28,6 +30,13 @@
     elsif ($method eq 'ping') {
       return _jsonrpc_response({}, $id);
     }
+    elsif ($method eq 'prompts/list') {
+      my $result = $self->_handle_prompts_list;
+      return _jsonrpc_response($result, $id);
+    }
+    elsif ($method eq 'prompts/get') {
+      return $self->_handle_prompts_get($request->{params} // {}, $id, 
$context);
+    }
     elsif ($method eq 'tools/list') {
       my $result = $self->_handle_tools_list;
       return _jsonrpc_response($result, $id);
@@ -44,6 +53,12 @@
   return undef;
 }
 
+sub prompt ($self, %args) {
+  my $prompt = MCP::Prompt->new(%args);
+  push @{$self->prompts}, $prompt;
+  return $prompt;
+}
+
 sub to_action ($self) {
   $self->transport(my $http = MCP::Server::Transport::HTTP->new(server => 
$self));
   return sub ($c) { $http->handle_request($c) };
@@ -63,11 +78,33 @@
 sub _handle_initialize ($self, $params) {
   return {
     protocolVersion => PROTOCOL_VERSION,
-    capabilities    => {tools => {}},
-    serverInfo      => {name  => $self->name, version => $self->version}
+    capabilities    => {prompts => {},          tools   => {}},
+    serverInfo      => {name    => $self->name, version => $self->version}
   };
 }
 
+sub _handle_prompts_list ($self) {
+  my @prompts;
+  for my $prompt (@{$self->prompts}) {
+    my $info = {name => $prompt->name, description => $prompt->description, 
arguments => $prompt->arguments};
+    push @prompts, $info;
+  }
+
+  return {prompts => \@prompts};
+}
+
+sub _handle_prompts_get ($self, $params, $id, $context) {
+  my $name = $params->{name}      // '';
+  my $args = $params->{arguments} // {};
+  return _jsonrpc_error(METHOD_NOT_FOUND, "Prompt '$name' not found")
+    unless my $prompt = first { $_->name eq $name } @{$self->prompts};
+  return _jsonrpc_error(INVALID_PARAMS, 'Invalid arguments') if 
$prompt->validate_input($args);
+
+  my $result = $prompt->call($args, $context);
+  return $result->then(sub { _jsonrpc_response($_[0], $id) }) if 
blessed($result) && $result->isa('Mojo::Promise');
+  return _jsonrpc_response($result, $id);
+}
+
 sub _handle_tools_call ($self, $params, $id, $context) {
   my $name = $params->{name}      // '';
   my $args = $params->{arguments} // {};
@@ -113,6 +150,25 @@
 
   my $server = MCP::Server->new(name => 'MyServer');
 
+  $server->tool(
+    name         => 'echo',
+    description  => 'Echo the input text',
+    input_schema => {type => 'object', properties => {msg => {type => 
'string'}}, required => ['msg']},
+    code         => sub ($tool, $args) {
+      return "Echo: $args->{msg}";
+    }
+  );
+
+  $server->prompt(
+    name        => 'echo',
+    description => 'A prompt to demonstrate the echo tool',
+    code        => sub ($prompt, $args) {
+      return 'Use the echo tool with the message "Hello, World!"';
+    }
+  );
+
+  $server->to_stdio;
+
 =head1 DESCRIPTION
 
 L<MCP::Server> is an MCP (Model Context Protocol) server.
@@ -159,6 +215,17 @@
 
 Handle a JSON-RPC request and return a response.
 
+=head2 prompt
+
+  my $prompt = $server->prompt(
+    name        => 'my_prompt',
+    description => 'A sample prompt',
+    arguments   => [{name => 'foo', description => 'Whatever', required => 1}],
+    code        => sub ($prompt, $args) { ... }
+  );
+
+Register a new prompt with the server.
+
 =head2 to_action
 
   my $action = $server->to_action;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MCP-0.04/lib/MCP.pm new/MCP-0.05/lib/MCP.pm
--- old/MCP-0.04/lib/MCP.pm     2025-08-01 19:31:43.401796082 +0200
+++ new/MCP-0.05/lib/MCP.pm     2025-08-28 15:18:09.748755798 +0200
@@ -1,7 +1,7 @@
 package MCP;
 use Mojo::Base -base, -signatures;
 
-our $VERSION = '0.04';
+our $VERSION = '0.05';
 
 1;
 
@@ -32,9 +32,9 @@
 
 =head1 DESCRIPTION
 
-Connect Perl with AI using the Model Context Protocol (MCP). Currently this 
module is focused on tool calling, but it
-will be extended to support other MCP features in the future. At its core, MCP 
is all about text processing, making it
-a great fit for Perl.
+Connect Perl with AI using the Model Context Protocol (MCP). Currently this 
module is focused on tool calling and
+prompts, but it will be extended to support other MCP features in the future. 
At its core, MCP is all about text
+processing, making it a great fit for Perl.
 
 =head3 Streamable HTTP Transport
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MCP-0.04/t/apps/lite_app.pl 
new/MCP-0.05/t/apps/lite_app.pl
--- old/MCP-0.04/t/apps/lite_app.pl     2025-08-04 14:47:05.061371664 +0200
+++ new/MCP-0.05/t/apps/lite_app.pl     2025-08-28 15:47:20.079204872 +0200
@@ -73,6 +73,34 @@
     return $tool->structured_result({temperature => 19, conditions => 
'Raining', humidity => 80});
   }
 );
+$server->prompt(
+  name        => 'time',
+  description => 'Tell the user the time',
+  code        => sub ($tool, $args) {
+    return 'Tell the user the current time';
+  }
+);
+$server->prompt(
+  name        => 'prompt_echo_async',
+  description => 'Make a prompt from the input text',
+  arguments   => [{name => 'msg', description => 'Message to echo', required 
=> 1}],
+  code        => sub ($prompt, $args) {
+    my $promise = Mojo::Promise->new;
+    Mojo::IOLoop->timer(0.5 => sub { $promise->resolve("Tell the user (async): 
$args->{msg}") });
+    return $promise;
+  }
+);
+$server->prompt(
+  name        => 'prompt_echo_header',
+  description => 'Make a prompt from the input text with a header',
+  arguments   => [{name => 'msg', description => 'Message to echo', required 
=> 1}],
+  code        => sub ($prompt, $args) {
+    my $context = $prompt->context;
+    my $header  = 
$context->{controller}->req->headers->header('Mcp-Custom-Header');
+    return $prompt->text_prompt("Prompt with header: $args->{msg} (Header: 
$header)",
+      'assistant', 'Echoed message with header');
+  }
+);
 
 any '/mcp' => $server->to_action;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MCP-0.04/t/lite_app.t new/MCP-0.05/t/lite_app.t
--- old/MCP-0.04/t/lite_app.t   2025-08-04 14:50:15.900302745 +0200
+++ new/MCP-0.05/t/lite_app.t   2025-08-28 16:02:01.351224139 +0200
@@ -26,8 +26,10 @@
     is $result->{protocolVersion},     PROTOCOL_VERSION, 'protocol version';
     is $result->{serverInfo}{name},    'PerlServer',     'server name';
     is $result->{serverInfo}{version}, '1.0.0',          'server version';
-    ok $result->{capabilities}, 'has capabilities';
-    ok $client->session_id,     'session id set';
+    ok $result->{capabilities},          'has capabilities';
+    ok $result->{capabilities}{prompts}, 'has prompts capability';
+    ok $result->{capabilities}{tools},   'has tools capability';
+    ok $client->session_id,              'session id set';
   };
 
   subtest 'Ping' => sub {
@@ -156,6 +158,63 @@
     eval { $client->call_tool('echo', {just => 'a test'}) };
     like $@, qr/Error -32602: Invalid arguments/, 'right error';
   };
+
+  subtest 'List prompts' => sub {
+    my $result = $client->list_prompts;
+    is $result->{prompts}[0]{name},        'time',                   'prompt 
name';
+    is $result->{prompts}[0]{description}, 'Tell the user the time', 'prompt 
description';
+    is_deeply $result->{prompts}[0]{arguments}, [], 'no prompt arguments';
+    is $result->{prompts}[1]{name},        'prompt_echo_async',                
 'prompt name';
+    is $result->{prompts}[1]{description}, 'Make a prompt from the input 
text', 'prompt description';
+    is_deeply $result->{prompts}[1]{arguments}, [{name => 'msg', description 
=> 'Message to echo', required => 1}],
+      'prompt arguments';
+    is $result->{prompts}[2]{name},        'prompt_echo_header',               
               'prompt name';
+    is $result->{prompts}[2]{description}, 'Make a prompt from the input text 
with a header', 'prompt description';
+    is_deeply $result->{prompts}[2]{arguments}, [{name => 'msg', description 
=> 'Message to echo', required => 1}],
+      'prompt arguments';
+    is $result->{prompts}[3], undef, 'no more prompts';
+  };
+
+  subtest 'Get prompt' => sub {
+    my $result = $client->get_prompt('time');
+    is $result->{messages}[0]{role},             'user',                       
    'prompt role';
+    is $result->{messages}[0]{content}[0]{text}, 'Tell the user the current 
time', 'prompt result';
+  };
+
+  subtest 'Get prompt (async)' => sub {
+    my $result = $client->get_prompt('prompt_echo_async', {msg => 'hello 
mojo'});
+    is $result->{messages}[0]{role},             'user',                       
       'prompt role';
+    is $result->{messages}[0]{content}[0]{text}, 'Tell the user (async): hello 
mojo', 'prompt result';
+  };
+
+  subtest 'Get prompt (Unicode)' => sub {
+    my $result = $client->get_prompt('prompt_echo_async', {msg => 'i ♥ mcp'});
+    is $result->{messages}[0]{role},             'user',                       
    'prompt role';
+    is $result->{messages}[0]{content}[0]{text}, 'Tell the user (async): i ♥ 
mcp', 'prompt result';
+  };
+
+  subtest 'Get prompt (with HTTP header)' => sub {
+    $client->ua->once(
+      start => sub ($ua, $tx) {
+        $tx->req->headers->header('MCP-Custom-Header' => 'TestHeaderWorks');
+      }
+    );
+    my $result = $client->get_prompt('prompt_echo_header', {msg => 'hello 
mojo'});
+    is $result->{description},       'Echoed message with header', 'prompt 
description';
+    is $result->{messages}[0]{role}, 'assistant',                  'prompt 
role';
+    is $result->{messages}[0]{content}[0]{text}, 'Prompt with header: hello 
mojo (Header: TestHeaderWorks)',
+      'prompt result';
+  };
+
+  subtest 'Invalid prompt name' => sub {
+    eval { $client->get_prompt('unknownPrompt', {}) };
+    like $@, qr/Error -32601: Prompt 'unknownPrompt' not found/, 'right error';
+  };
+
+  subtest 'Invalid prompt arguments' => sub {
+    eval { $client->get_prompt('prompt_echo_async', {just => 'a test'}) };
+    like $@, qr/Error -32602: Invalid arguments/, 'right error';
+  };
 };
 
 done_testing;

++++++ _scmsync.obsinfo ++++++
--- /var/tmp/diff_new_pack.wtqkAx/_old  2025-10-07 18:31:36.081654518 +0200
+++ /var/tmp/diff_new_pack.wtqkAx/_new  2025-10-07 18:31:36.089654855 +0200
@@ -1,6 +1,6 @@
-mtime: 1755015324
-commit: d8a706901638c3353654593d976bb36086144c5259cee6d4c8c6b45c41f56c2c
+mtime: 1759776480
+commit: e21f3db092ea60701794b7a8b2d24c37925e3eb2ca3ccdb614af427f82f125d4
 url: https://src.opensuse.org/perl/perl-MCP.git
-revision: d8a706901638c3353654593d976bb36086144c5259cee6d4c8c6b45c41f56c2c
+revision: e21f3db092ea60701794b7a8b2d24c37925e3eb2ca3ccdb614af427f82f125d4
 projectscmsync: https://src.opensuse.org/perl/_ObsPrj
 

++++++ build.specials.obscpio ++++++

++++++ build.specials.obscpio ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/.gitignore new/.gitignore
--- old/.gitignore      1970-01-01 01:00:00.000000000 +0100
+++ new/.gitignore      2025-10-07 12:45:12.000000000 +0200
@@ -0,0 +1 @@
+.osc

Reply via email to