TsgcWSAPIServer_MCP › Events

TsgcWSAPIServer_MCP Events

Events you can handle, grouped by purpose, followed by the full alphabetical list.

Session

NameDescription
OnMCPInitializeFired during the MCP handshake so server capabilities and ServerInfo can be customised per session.
OnMCPSessionNewRaised every time a new MCP session is created.
OnMCPSessionEndTriggered when a session is closed or expires through SessionTimeout.
OnMCPExceptionInvoked when an unhandled exception reaches the server; allows overriding the HTTP response code.

Incoming requests

NameDescription
OnMCPRequestToolRaised when a client issues tools/call; populate the response with the tool’s result.
OnMCPRequestPromptRaised when a client issues prompts/get; fill the messages returned for that prompt template.
OnMCPRequestResourceRaised when a client issues resources/read; stream the resource content back to the caller.

Responses

NameDescription
OnMCPResponseRootsListReceives the client’s reply to RequestRootsList, exposing the shared roots.
OnMCPResponseSamplingCreateMessageReceives the client’s reply to RequestSamplingCreateMessage with the generated message.
OnMCPResponseElicitationCreateReceives the client’s reply to RequestElicitationCreate with the elicited values.

HTTP

NameDescription
OnMCPHTTPRequestFires when an HTTP request reaches the MCP endpoint; set Handled := True to supply a custom response.
OnMCPHTTPResponseFires after the HTTP response has been serialized; use it to add headers or log the exchange.

All Events (alphabetical)

NameDescription
OnMCPExceptionInvoked when an unhandled exception reaches the server; allows overriding the HTTP response code.
OnMCPHTTPRequestFires when an HTTP request reaches the MCP endpoint; set Handled := True to supply a custom response.
OnMCPHTTPResponseFires after the HTTP response has been serialized; use it to add headers or log the exchange.
OnMCPInitializeFired during the MCP handshake so server capabilities and ServerInfo can be customised per session.
OnMCPRequestPromptRaised when a client issues prompts/get; fill the messages returned for that prompt template.
OnMCPRequestResourceRaised when a client issues resources/read; stream the resource content back to the caller.
OnMCPRequestToolRaised when a client issues tools/call; populate the response with the tool’s result.
OnMCPResponseElicitationCreateReceives the client’s reply to RequestElicitationCreate with the elicited values.
OnMCPResponseRootsListReceives the client’s reply to RequestRootsList, exposing the shared roots.
OnMCPResponseSamplingCreateMessageReceives the client’s reply to RequestSamplingCreateMessage with the generated message.
OnMCPSessionEndTriggered when a session is closed or expires through SessionTimeout.
OnMCPSessionNewRaised every time a new MCP session is created.