33 #include <Pt/Mcp/Api.h>
34 #include <Pt/NonCopyable.h>
59 explicit Type(TypeId
id)
71 const std::string& description =
"")
const;
78 PT_MCP_API
const Type& nullType();
80 PT_MCP_API
const Type& integerType();
82 PT_MCP_API
const Type& numberType();
84 PT_MCP_API
const Type& stringType();
86 PT_MCP_API
const Type& booleanType();
95 const std::string& description =
"");
97 const std::string& name()
const
100 const Type& type()
const
103 const std::string& description()
const
104 {
return _description; }
106 bool isRequired()
const
107 {
return _required; }
110 { _required =
false; }
115 std::string _description;
132 ObjectType& addProperty(
const std::string& name,
const Type& type,
133 const std::string& description =
"");
135 ObjectType& setOptional(
const std::string& name);
141 const std::vector<Property>& properties()
const
142 {
return _properties; }
144 bool isStrict()
const
148 const std::string& description =
"")
const override;
151 std::vector<Property> _properties;
167 const Type& items()
const
171 const std::string& description =
"")
const override;
187 EnumType& addValue(
const std::string& value);
189 const std::vector<std::string>& values()
const
193 const std::string& description =
"")
const override;
196 std::vector<std::string> _values;
211 const Type& inner()
const
215 const std::string& description =
"")
const override;
225 #endif // PT_MCP_TYPE_H
Core module.
Definition: Allocator.h:33
virtual void toSchema(std::ostream &os, const std::string &description="") const
Writes the JSON Schema representation to the stream.
void toSchema(std::ostream &os, const std::string &description="") const override
Writes the JSON Schema representation to the stream.
Property of an ObjectType.
Definition: Type.h:92
Object type with named properties.
Definition: Type.h:126
Nullable wrapper that allows null as an alternative value.
Definition: Type.h:205
Enum type with a fixed set of allowed string values.
Definition: Type.h:181
JSON Schema type descriptor for MCP tool parameters.
Definition: Type.h:46
void toSchema(std::ostream &os, const std::string &description="") const override
Writes the JSON Schema representation to the stream.
ObjectType & setStrict()
Disallow properties not listed in the schema.
void toSchema(std::ostream &os, const std::string &description="") const override
Writes the JSON Schema representation to the stream.
void toSchema(std::ostream &os, const std::string &description="") const override
Writes the JSON Schema representation to the stream.
Unicode capable basic_string.
Definition: Api-String.h:44
Protects derived classes from being copied.
Definition: NonCopyable.h:54
Array type with element type.
Definition: Type.h:161