cxxmcp 1.1.6
C++ MCP SDK
Loading...
Searching...
No Matches
schema_validator.hpp
Go to the documentation of this file.
1// Copyright (c) 2025 [caomengxuan666]
2
3#pragma once
4
7
8#include <string>
9
12
13namespace mcp::server {
14
17 ToolInput,
18 ToolOutput,
19 Elicitation,
20};
21
25 SchemaValidationTarget target = SchemaValidationTarget::ToolInput;
27 std::string tool_name;
28};
29
36 public:
37 virtual ~JsonSchemaValidator() = default;
38
42 const protocol::Json& schema, const protocol::Json& instance,
43 const SchemaValidationContext& context) const = 0;
44};
45
46} // namespace mcp::server
Interface for integrating a JSON Schema validator implementation.
Definition schema_validator.hpp:35
virtual core::Result< core::Unit > validate(const protocol::Json &schema, const protocol::Json &instance, const SchemaValidationContext &context) const =0
Validate an instance against a schema.
Shared JSON, JSON-RPC, error, cancellation, and progress model types.
nlohmann::json Json
JSON value type used by all protocol DTOs.
Definition types.hpp:28
Shared result and error primitives used by the public cxxmcp SDK.
tl::expected< T, Error > Result
Alias for the SDK result type.
Definition result.hpp:64
SchemaValidationTarget
Server-side SDK location that requested schema validation.
Definition schema_validator.hpp:16
Metadata supplied to a user-provided JSON Schema validator.
Definition schema_validator.hpp:23
std::string tool_name
Tool name for tool input/output validation.
Definition schema_validator.hpp:27
SchemaValidationTarget target
Validation site within the SDK.
Definition schema_validator.hpp:25