#include <Pt/Mcp/Type.h>
JSON Schema type for an MCP tool parameter. More...
Inherits NonCopyable.
Inherited by ArrayType, EnumType, NullableType, and ObjectType.
Public Types | |
| enum | TypeId { Null = 0 , Integer = 1 , Number = 2 , String = 3 , Boolean = 4 , Object = 5 , Array = 6 } |
| JSON Schema kind of a Type. More... | |
Public Member Functions | |
| Type (TypeId id) | |
| Creates a type with schema kind id. | |
| virtual | ~Type () |
| Destroys the type. | |
| TypeId | typeId () const |
| Returns the JSON Schema kind of this type. | |
| virtual void | toSchema (std::ostream &os, const std::string &description="") const |
| Writes this type as a JSON Schema object to os. | |
Type is the schema node the parameter-schema group described. It is either a primitive from integerType() and the other factories, or a composed type the caller owns. typeId() is the JSON Schema kind. toSchema() writes that kind as a JSON object, with an optional description. Composed types override toSchema() to add properties, items, enum values, or null.
The type does not own other types. An ObjectType, ArrayType, or NullableType stores pointers to the types it names, and those types must outlive it. Type is not copyable.
| enum TypeId |
|
virtual |
When description is not empty, it is written as the schema description member.
Reimplemented in ArrayType, EnumType, NullableType, and ObjectType.