Table of Contents

TTMSMCPJSONSchemaGenerator Class

Generates a draft-07 compatible JSON Schema from a class or record by reflecting its members at run time. It is what turns an object-typed tool parameter into a full nested schema instead of a bare object type, and it can also be used directly to describe a structured tool result.

API unit family: TMS.MCP.JSONSchema

Syntax

TTMSMCPJSONSchemaGenerator = class

Remarks

Every entry point is a class function, so no instance has to be created, and the caller owns every returned object and must destroy it. Generation is driven by attributes declared alongside the reflected members: a description attribute adds a description, a name attribute overrides the key the member is published under, an optional attribute keeps the member out of the required array, and the string, float, integer and Boolean attributes force the published type of a member.

Methods

Name Description
FromClass Generates a schema from a class reference resolved at run time, using the default settings.
FromObject Generates a schema from a live object, reflecting the class the instance actually is, so a descendant is described rather than the declared type. Uses the default settings.
FromTypeInfo Generates a schema from type information obtained at run time, using the default settings. It is the low-level entry point the other overloads resolve to, and the one to use when the type is only known through its type information.
SchemaToString Serializes a generated schema to a JSON string, either indented for reading or compact for transport.

Used by