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§
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