NAME
Net::Async::MCP::JSONRPC - How the transports read the error of a JSON-RPC response
VERSION
version 0.007
DESCRIPTION
The one place the transports - Net::Async::MCP::Transport::Stdio, Net::Async::MCP::Transport::HTTP and Net::Async::MCP::Transport::InProcess - decide whether the error of a decoded response is a JSON-RPC error object or something else that only says the request failed. What a server answers is foreign input, whether it came off the wire or from a server object in process: a shape this client cannot read as JSON-RPC must still fail the request, and must never be reached into as if it were an object.
This is an internal helper of the distribution, not a public API. Both methods are class methods.
error_failure
my @failure = Net::Async::MCP::JSONRPC->error_failure($response);
return Future->fail(@failure) if @failure;
Takes a decoded response and returns the arguments a Future is failed with when its error is a JSON-RPC error object - a hash with a defined code: ( "MCP error $code: $message", mcp => $error ), the message reading (no message) where the server sent none. Returns the empty list for anything else, a response that is no hash included.
error_text
my $text = Net::Async::MCP::JSONRPC->error_text($response->{error});
The text an error that "error_failure" did not accept carries: a plain value as it is, a structure as its JSON, and unknown error where even that cannot be had. A transport puts its own prefix before it.
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-net-async-mcp/issues.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <getty@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.