Table of Contents

Tools

A tool is a callable operation that an MCP client — and through it, a language model — can invoke on your server. Each tool declares a name, a description, and a set of typed input properties, so the model knows both what the tool does and exactly what arguments it accepts. TTMSMCPTool covers the whole surface: simple single-argument callbacks, structured arguments including arrays of objects, behaviour hints that tell a client whether a call is safe to repeat, JSON output schemas, native MCP content items, and opt-in execution as a long-running task.

Documentation

Start here Use when
Getting started You want a working tool on a server quickly.
User guide You want task-oriented chapters grouped by feature area.
API reference You want exact class, property, method, and event contracts.
Release notes You want the version history for this component.

Key classes

Class Role
TTMSMCPTool A single callable tool: name, description, input properties, hints, and the method that runs it.
TTMSMCPTools The collection of tools owned by a server. Add, find, and register tools here.
TTMSMCPToolProperty One declared input argument: name, type, required flag, description, enum values.
TTMSMCPToolProperties The collection of input properties on a tool.
TTMSMCPArrayItemProperty One field inside an array-of-objects argument.
TTMSMCPToolBuilder Fluent builder for declaring a tool in a single expression.
TTMSMCPToolPropertyBuilder Fluent builder for one input property, returned by AddProperty.
TTMSMCPContent Builds native MCP content items — text and resource links — for a tool result.
TTMSMCPJSONSchemaGenerator Generates a JSON schema from a Delphi type, for output schemas and object arguments.

Minimal example

procedure TForm1.RegisterGreetTool;
var
  Prop: TTMSMCPToolProperty;
begin
  { Server is a TTMSMCPServer dropped on the form. }
  Server.Tools.RegisterTool('greet_user', 'Generates a greeting for a person',
    function(const Args: array of TValue): TValue
    begin
      Result := Format('Hello, %s!', [Args[0].AsString]);
    end,
    ptString);

  { RegisterTool creates the tool with no declared input properties, so
    declare them separately - the client needs them to build the call. }
  Prop := Server.Tools.FindByName('greet_user').Properties.Add;
  Prop.Name := 'name';
  Prop.Description := 'Name of the person to greet';
  Prop.PropertyType := ptString;
  Prop.Required := True;
end;

API map

Role Types
Tool and collection TTMSMCPTool, TTMSMCPTools
Input declaration TTMSMCPToolProperty, TTMSMCPToolProperties, TTMSMCPArrayItemProperty, TTMSMCPArrayItemProperties, TTMSMCPToolPropertyType
Fluent construction TTMSMCPToolBuilder, TTMSMCPToolPropertyBuilder
Execution callbacks TTMSMCPMethod, TTMSMCPMethodEvent, TTMSMCPDynamicMethod, TTMSMCPDynamicMethodEvent, TTMSMCPDynamicStructuredMethod
Results TTMSMCPContent, TTMSMCPValue, TTMSMCPValues
Schema TTMSMCPJSONSchemaGenerator, TTMSMCPJSONSchemaOptions, TTMSMCPGenerateInputSchemaEvent
Task execution TTMSMCPTaskSupport

Guides

Guide Covers
Defining tools Registering tools, declaring typed properties, enums, arrays of objects, and behaviour hints.
Tool results Return types, structured output with a JSON schema, native content items, and long-running tasks.

See Also