TTMSMCPCustomClientConnection Class
Base class for a single configured server connection. It owns the transport that reaches the server, performs the handshake, caches the tool, resource and prompt catalogs the server publishes, and routes every response and notification to the matching event.
API unit family: TMS.MCP.Client.Connection
Inherits from: TCollectionItem
Syntax
TTMSMCPCustomClientConnection = class(TCollectionItem)
Remarks
A connection is a collection item, so it is created and released by the collection that holds it. Descendants supply the identity of the owning client and the request bookkeeping; use the concrete descendant rather than this class directly. Messages arrive on a transport thread, so the events that report results are raised on the main thread; the HTTP request and response events are the exception and run on the thread that performs the exchange.
Properties
| Name | Description |
|---|---|
| Args | Command-line arguments passed to the server process, one argument per line. |
| Capabilities | Optional features this connection announces to its server during the handshake. |
| Command | Executable launched as the server process when the connection uses standard streams. |
| DataBoolean | Free Boolean slot an application may use to associate its own state with this connection. True and False mean whatever the application decides: the connection behaves identically either way. It starts out False. |
| DataInteger | Free integer slot an application may use to associate its own data with this connection. |
| DataObject | Free object slot an application may use to associate its own data with this connection. |
| DataPointer | Free pointer slot an application may use to associate its own data with this connection. |
| DataString | Free text slot an application may use to associate its own data with this connection. |
| DisplayName | Label identifying this connection in an application, independent of the name the server reports. |
| EnvironmentVariables | Environment entries given to the server process, one NAME=value entry per line. |
| HasLogging | Reports whether the server declared that it pushes log records. |
| HasPrompts | Reports whether the server declared that it publishes prompts. |
| HasResources | Reports whether the server declared that it publishes resources. |
| HasTools | Reports whether the server declared that it publishes tools. |
| OAuth | Authorization settings of the underlying HTTP transport. |
| ServerName | Name the server reported for itself during the handshake. |
| ServerVersion | Version the server reported for itself during the handshake. |
| TransportType | Channel this connection uses to reach its server. |
| URL | Address of the remote server, used by the HTTP and server-sent-events transports. |
Methods
| Name | Description |
|---|---|
| CancelRequest | Asks the server to abandon a request that is still in flight. |
| GetPrompts | Returns the prompt catalog the server published, one entry per prompt. |
| GetResources | Returns the resource catalog the server published, one entry per resource. |
| GetTools | Returns the tool catalog the server published, one entry per tool. |
| Invoke | Sends any protocol request, for cases the dedicated methods do not cover. |
| IsRunning | Reports whether the transport is currently open. |
| Notify | Sends a notification, that is a message the server never answers. |
| Ping | Sends a liveness check to the server. |
| Send | Sends a prepared protocol message over the transport without naming the method it carries. |
| SetLoggingLevel | Sets the lowest severity of log record the server should push. |
| Start | Opens the transport and begins the handshake with the server. |
| Stop | Closes the transport and discards the cached tool, resource, resource template and prompt catalogs. |
Events
| Name | Description |
|---|---|
| OnBeforeHTTPRequest | Occurs before each HTTP request, so the application can add its own headers. |
| OnElicitationCreate | Occurs when the server asks the application to collect input from the user. |
| OnError | Occurs when a request fails or the server reports an error. |
| OnGetPromptsList | Occurs when the complete prompt catalog has been received, including every page. |
| OnGetResourcesList | Occurs when the complete resource catalog has been received, including every page. |
| OnGetResourcesTemplateList | Occurs when the complete resource template catalog has been received, including every page. |
| OnGetToolsList | Occurs when the complete tool catalog has been received, including every page. |
| OnHTTPResponse | Occurs for each HTTP response before its payload is interpreted as a protocol message. |
| OnInitialized | Occurs when the handshake has completed and the server identity and capabilities are known. |
| OnLogging | Occurs when the server pushes a log record. |
| OnPromptsGet | Occurs when a prompt retrieval returns its description and messages. |
| OnPromptsListChanged | Occurs when the server reports that its prompt catalog changed. |
| OnResourcesListChanged | Occurs when the server reports that its resource catalog changed. |
| OnResourcesRead | Occurs when a resource read returns its content blocks. |
| OnResourcesUpdated | Occurs when the server reports that the content of a subscribed resource changed. |
| OnToolResponse | Occurs when a tool call returns its content blocks. |
| OnToolsListChanged | Occurs when the server reports that its tool catalog changed. |