Skip to main content

qualia_mcp/
resources.rs

1//! MCP Resource endpoints and QApp Host Surface schema handlers.
2//!
3//! Follows `AGENTS.md` ยง0-B (<500 lines).
4
5use crate::types::McpSystemError;
6use serde_json::json;
7
8pub const QAPP_SURFACE_SCHEMA_URI: &str = "qualia://qapp-surface-schema";
9
10/// Return static JSON-schema describing the QApp Host Surface.
11pub fn get_qapp_surface_schema() -> String {
12    json!({
13        "$schema": "https://json-schema.org/draft/2020-12/schema",
14        "title": "QualiaQappSurfaceSchema",
15        "description": "Schema defining the execution contract and resource surface for Qualia QApps.",
16        "type": "object",
17        "required": ["surfaceVersion", "capabilities", "modalities"],
18        "properties": {
19            "surfaceVersion": { "type": "string", "const": "2026.1" },
20            "protocolVersion": { "type": "string", "const": "2024-11-05" },
21            "capabilities": {
22                "type": "array",
23                "items": { "type": "string" },
24                "default": [
25                    "sparql-query",
26                    "shacl-validation",
27                    "vibe-scripting",
28                    "geomechanics-simulation",
29                    "space-weather-simulation",
30                    "fire-ecology-simulation",
31                    "geospatial-indexing",
32                    "biosense-rppg",
33                    "spatial-audio-hrtf",
34                    "qpu-optimization",
35                    "ambient-orchestration"
36                ]
37            },
38            "modalities": {
39                "type": "array",
40                "items": { "type": "string" },
41                "default": ["ltl", "asp", "deontic", "epistemic", "paraconsistent", "probabilistic"]
42            }
43        }
44    })
45    .to_string()
46}
47
48/// `describe_qapp_surface_schema` tool handler.
49pub fn describe_qapp_surface_schema(_args: &[u8]) -> Result<String, McpSystemError> {
50    Ok(get_qapp_surface_schema())
51}