Hermes.Server.Component.Schema (hermes_mcp v0.10.0)
Handles schema conversion between Peri and JSON Schema formats for MCP protocol compliance.
This module provides utilities to:
- Convert Peri schemas to JSON Schema format
- Transform schemas to prompt argument definitions
- Format validation errors for client responses
Summary
Functions
Formats Peri validation errors into a human-readable string.
Converts a Peri schema definition to JSON Schema format.
Converts a Peri schema to prompt argument definitions.
Functions
Formats Peri validation errors into a human-readable string.
Converts a Peri schema definition to JSON Schema format.
Examples
iex> to_json_schema(%{name: :string, age: {:required, :integer}})
%{
"type" => "object",
"properties" => %{
"name" => %{"type" => "string"},
"age" => %{"type" => "integer"}
},
"required" => ["age"]
}
Converts a Peri schema to prompt argument definitions.
Examples
iex> to_prompt_arguments(%{language: {:required, :string}, focus: :string})
[
%{"name" => "language", "description" => "Required string parameter", "required" => true},
%{"name" => "focus", "description" => "Optional string parameter", "required" => false}
]