Table of Contents

TTMSMCPToolBuilder Class

Fluent builder that configures a tool step by step and hands back the finished instance, as an alternative to creating a tool and assigning its properties one by one.

API unit family: TMS.MCP.Tools Inherits from: TPersistent

Syntax

TTMSMCPToolBuilder = class(TPersistent)

Remarks

Every step is a class function returning the builder class, so the chain is written on the class rather than on an instance; a chain is started from the tool's create-builder method and closed with the build step. The tool under construction is kept in class-level state, so only one tool can be built at a time and the chain must be completed before another is started.

Methods

Name Description
AddIcon Adds an icon to the tool so a client can show it with an image. Call it repeatedly to publish the same icon in several sizes or formats.
AddProperty Starts an input parameter for the tool and switches the chain to the property builder.
Build Finishes the chain and returns the configured tool, releasing the builder so another tool can be started.
Description Sets the description published with the tool, which is what a model reads to decide whether to invoke it.
DestructiveHint Warns that the tool may change or remove existing data in a way that cannot be undone, so a client should confirm with the user before invoking it. It only carries meaning for a tool that is not read-only.
DynamicExecuteCallback Assigns the callback that runs when the tool is invoked, receiving its arguments keyed by parameter name. Choose it over the positional callback when optional parameters may be absent from a call.
ExecuteCallback Assigns the callback that runs when the tool is invoked, receiving its arguments by position in parameter declaration order.
IdempotentHint Declares that repeating the call with the same arguments has no further effect beyond the first call, so a client may safely retry it after a timeout or an unclear failure.
Initialize Starts a new tool. It is called by the tool's create-builder method rather than directly.
Name Sets the name the tool is published and invoked under.
OpenWorldHint Declares that the tool reaches out to an open, external world such as the internet or a third-party service, so its result may differ between two identical calls and cannot be predicted from the arguments alone.
OutputSchema Publishes a JSON Schema describing the structured result of the tool. Pair it with the structured callback so the returned object matches the advertised schema.
ReadOnlyHint Declares that the tool only reads and never changes anything, so a client may run it without asking the user for permission first.
ReturnType Sets the declared type of the value the callback returns, which selects how that value is converted to JSON.
StructuredExecuteCallback Assigns the callback that receives the arguments by name and returns a ready-made JSON object, used when the result must match a declared output schema.
TaskSupport Declares whether a client may, or must, invoke the tool as a long-running task. The setting is an advertisement only and does not by itself make the callback run asynchronously.
Title Sets the short human-readable label a client shows in place of the raw tool name.