9#include <Pt/NonCopyable.h>
70 const std::string& description =
"")
const;
129 const std::string&
name()
const
140 {
return _description; }
145 {
return _required; }
150 { _required =
false; }
155 std::string _description;
190 const std::string& description =
"");
203 {
return _properties; }
213 const std::string& description =
"")
const override;
216 std::vector<Property> _properties;
248 const std::string& description =
"")
const override;
281 const std::vector<std::string>&
values()
const
287 const std::string& description =
"")
const override;
290 std::vector<std::string> _values;
323 const std::string& description =
"")
const override;
void toSchema(std::ostream &os, const std::string &description="") const override
Writes this array as a JSON Schema object to os.
~ArrayType()
Destroys the array schema.
const Type & items() const
Returns the schema type of the array elements.
Definition Type.h:242
ArrayType(const Type &items)
Creates an array schema whose items have type items.
const std::vector< std::string > & values() const
Returns the allowed string values.
Definition Type.h:281
EnumType & addValue(const std::string &value)
Adds value to the set of allowed strings.
void toSchema(std::ostream &os, const std::string &description="") const override
Writes this enum as a JSON Schema object to os.
~EnumType()
Destroys the enum schema.
EnumType()
Creates an enum schema with no values.
const Type & inner() const
Returns the wrapped schema type.
Definition Type.h:317
void toSchema(std::ostream &os, const std::string &description="") const override
Writes this nullable type as a JSON Schema object to os.
NullableType(const Type &inner)
Creates a nullable wrapper around inner.
~NullableType()
Destroys the nullable wrapper.
ObjectType()
Creates an empty object schema.
ObjectType & setOptional(const std::string &name)
Marks the property named name as optional.
bool isStrict() const
Returns true when additional properties are forbidden.
Definition Type.h:207
void toSchema(std::ostream &os, const std::string &description="") const override
Writes this object as a JSON Schema object to os.
const std::vector< Property > & properties() const
Returns the properties of this object schema.
Definition Type.h:202
ObjectType & setStrict()
Forbids properties that are not listed in the schema.
~ObjectType()
Destroys the object schema.
ObjectType & addProperty(const std::string &name, const Type &type, const std::string &description="")
Adds a required property named name of type.
Property(const std::string &name, const Type &type, const std::string &description="")
Creates a required property named name of type.
const Type & type() const
Returns the schema type of this property.
Definition Type.h:134
const std::string & name() const
Returns the property name.
Definition Type.h:129
bool isRequired() const
Returns true when the property is required.
Definition Type.h:144
const std::string & description() const
Returns the schema description of this property.
Definition Type.h:139
void setOptional()
Marks the property as optional.
Definition Type.h:149
JSON Schema type for an MCP tool parameter.
Definition Type.h:34
virtual void toSchema(std::ostream &os, const std::string &description="") const
Writes this type as a JSON Schema object to os.
TypeId typeId() const
Returns the JSON Schema kind of this type.
Definition Type.h:61
Type(TypeId id)
Creates a type with schema kind id.
Definition Type.h:51
TypeId
JSON Schema kind of a Type.
Definition Type.h:39
@ Integer
JSON integer.
Definition Type.h:41
@ Boolean
JSON boolean.
Definition Type.h:44
@ Object
JSON object.
Definition Type.h:45
@ Null
JSON null.
Definition Type.h:40
@ String
JSON string.
Definition Type.h:43
@ Array
JSON array.
Definition Type.h:46
@ Number
JSON number.
Definition Type.h:42
virtual ~Type()
Destroys the type.
NonCopyable()
Default constructor.
Definition NonCopyable.h:63
PT_MCP_API const Type & nullType()
Returns the process-wide JSON null schema type.
PT_MCP_API const Type & stringType()
Returns the process-wide JSON string schema type.
PT_MCP_API const Type & integerType()
Returns the process-wide JSON integer schema type.
PT_MCP_API const Type & numberType()
Returns the process-wide JSON number schema type.
PT_MCP_API const Type & booleanType()
Returns the process-wide JSON boolean schema type.
Model Context Protocol (MCP) services.
Core module.
Definition Allocator.h:33