Table of Contents

TTMSMCPAttributedServer.AddObject Method

Adds an object as a target and registers the declarations found on it.

API unit family: TMS.MCP.Attributes.Server Declaring type: TTMSMCPAttributedServer

Syntax

function AddObject(AObject: TObject): TTMSMCPTarget;

Remarks

This is the difference that matters between the server and its target collection: adding a target to the collection only records it, while this method records it and then runs the reflection pass, which rebuilds the published tools, resources and prompts from every target. The target created here does not own the object, so the instance has to outlive the server or be removed from the collection before it is destroyed.

Parameters

Name Description
AObject Instance to reflect over. Nothing happens when nil is passed.

Returns

The target created for the object, the target it already had, or nil when nil was passed.