cxxmcp 1.1.6
C++ MCP SDK
Loading...
Searching...
No Matches
schema.hpp File Reference

Small JSON Schema builders for MCP tool and elicitation metadata. More...

#include <string>
#include <type_traits>
#include <utility>
#include <vector>
#include "cxxmcp/protocol/reflect.hpp"
#include "cxxmcp/protocol/types.hpp"

Go to the source code of this file.

Classes

class  mcp::protocol::JsonSchema
 Primitive JSON Schema helpers used by public SDK builders. More...
 
struct  mcp::protocol::SchemaTraits< T, Enable >
 Type-to-schema customization point for typed SDK helpers. More...
 
struct  mcp::protocol::SchemaTraits< Json >
 
struct  mcp::protocol::SchemaTraits< std::string >
 
struct  mcp::protocol::SchemaTraits< bool >
 
struct  mcp::protocol::SchemaTraits< T, std::enable_if_t< std::is_integral_v< T > &&!std::is_same_v< T, bool > > >
 
struct  mcp::protocol::SchemaTraits< T, std::enable_if_t< std::is_floating_point_v< T > > >
 
struct  mcp::protocol::SchemaTraits< std::vector< T > >
 
struct  mcp::protocol::SchemaTraits< std::optional< T > >
 
class  mcp::protocol::ObjectSchemaBuilder
 Fluent object-schema builder for tool input and output schemas. More...
 

Namespaces

namespace  mcp::protocol::detail
 Auto-generates JSON Schema from a Reflect<T> specialization.
 

Functions

template<class T >
Json mcp::protocol::schema_for ()
 Returns the JSON Schema advertised for a C++ type.
 
template<typename Struct , typename Field >
void mcp::protocol::detail::add_reflected_field_schema (Json &properties, Json &required, const FieldDescriptor< Struct, Field > &fd)
 
template<typename Struct >
void mcp::protocol::detail::add_reflected_field_schema (Json &, Json &, const ExtensionsField< Struct > &)
 
template<typename Struct , typename Field >
void mcp::protocol::detail::add_reflected_field_schema (Json &, Json &, const DeserializeOnlyField< Struct, Field > &)
 
template<class T >
Json mcp::protocol::detail::reflect_schema ()
 
ObjectSchemaBuilder mcp::protocol::object_schema ()
 Creates a fluent object-schema builder.
 

Detailed Description

Small JSON Schema builders for MCP tool and elicitation metadata.

Function Documentation

◆ schema_for()

template<class T >
Json mcp::protocol::schema_for ( )
inline

Returns the JSON Schema advertised for a C++ type.

For types with a Reflect<T> specialization, generates schema from reflected fields. For all other types, delegates to SchemaTraits<T>.