#include <Pt/Mcp/HttpService.h>
HTTP service that serves declared MCP tools. More...
Inherits Service.
Public Member Functions | |
| HttpService (Remoting::ServiceDefinition &serviceDef, const ToolDeclaration &decl) | |
| Creates a service for serviceDef and decl. | |
| virtual | ~HttpService () |
| Destroys the service. | |
| Responder * | getResponder (const Request &) |
| Creates a responder to handle request received by a server. | |
| void | releaseResponder (Responder *) |
| Destroys a responder created by a server. | |
Protected Member Functions | |
| virtual Http::Responder * | onGetResponder (const Http::Request &request) |
| Creates a responder to handle request received by a server. | |
| virtual void | onReleaseResponder (Http::Responder *resp) |
| Destroys a responder created by a server. | |
| virtual void | onUpgrade (Stream &stream) |
| Called when a 101 reply has upgraded a connection. | |
HttpService is the HTTP transport the HTTP group described. It is an Pt::Http::Service: the server asks it for a responder, and that responder handles one POST as initialize, tools/list, or tools/call. Attach it to an Pt::Http::Server with Pt::Http::MapUrl or another servlet. It does not listen and it does not implement MCP on GET.
The constructor stores the Pt::Remoting::ServiceDefinition and the ToolDeclaration. Neither is owned. Both must outlive this service, and this service must outlive any responder it has not yet released. Asynchronous tool procedures run on the server's EventLoop.
|
protectedvirtualinherited |
Runs on the server thread with the Stream the server owns. The responder has already been released. Bind a StreamSession to stream to accept it. The empty implementation leaves the stream unbound, and the server closes it.
Reimplemented in WebSocketService.