Hermes.Message (hermes_mcp v0.2.2)
Handles parsing and validation of MCP (Model Context Protocol) messages using the Peri library.
This module provides functions to parse and validate MCP messages based on the Model Context Protocol schema
Summary
Functions
Decodes raw data (possibly containing multiple messages) into JSON-RPC messages.
Encodes a notification message to a JSON-RPC 2.0 compliant string.
Encodes a request message to a JSON-RPC 2.0 compliant string.
Encodes a response message to a JSON-RPC 2.0 compliant string.
Determines if a JSON-RPC message is an error.
Determines if a JSON-RPC message is a notification.
Determines if a JSON-RPC message is a request.
Determines if a JSON-RPC message is a response.
Validates a decoded JSON message to ensure it complies with the MCP schema.
Functions
Decodes raw data (possibly containing multiple messages) into JSON-RPC messages.
Returns either:
{:ok, messages}
where messages is a list of parsed JSON-RPC messages{:error, reason}
if parsing fails
Encodes a notification message to a JSON-RPC 2.0 compliant string.
Returns the encoded string with a newline character appended.
Encodes a request message to a JSON-RPC 2.0 compliant string.
Returns the encoded string with a newline character appended.
Encodes a response message to a JSON-RPC 2.0 compliant string.
Returns the encoded string with a newline character appended.
Determines if a JSON-RPC message is an error.
Determines if a JSON-RPC message is a notification.
Determines if a JSON-RPC message is a request.
Determines if a JSON-RPC message is a response.
Validates a decoded JSON message to ensure it complies with the MCP schema.