Crate pulseengine_mcp_protocol

Source
Expand description

Core Model Context Protocol types and validation

This crate provides the fundamental types, traits, and validation logic for the Model Context Protocol. It serves as the foundation for building MCP servers and clients with strong type safety and validation.

§Quick Start

use pulseengine_mcp_protocol::{Tool, Content, CallToolResult};
use serde_json::json;

// Define a tool with proper schema
let tool = Tool {
    name: "get_weather".to_string(),
    description: "Get current weather for a location".to_string(),
    input_schema: json!({
        "type": "object",
        "properties": {
            "location": {
                "type": "string",
                "description": "City name or coordinates"
            }
        },
        "required": ["location"]
    }),
};

// Create a tool response
let result = CallToolResult {
    content: vec![Content::text("Current weather: 22°C, sunny".to_string())],
    is_error: Some(false),
};

This crate is currently used in production by the Loxone MCP Server for home automation with 30+ tools.

Re-exports§

pub use error::Error;
pub use error::Result;
pub use validation::Validator;
pub use model::*;

Modules§

error
Error types for the MCP protocol
model
MCP model types for protocol messages and data structures
validation
Validation utilities for MCP protocol types

Constants§

MCP_VERSION
Protocol version constants
SUPPORTED_PROTOCOL_VERSIONS

Functions§

is_protocol_version_supported
Check if a protocol version is supported
validate_protocol_version
Validate MCP protocol version compatibility