pub struct SchemaManager<S: SchemaStore> { /* private fields */ }Expand description
Top-level handle for one upstream MCP server’s schema view.
Generic over the store backend; downstream typically uses
SchemaManager<MemorySchemaStore> for the OSS proxy and swaps in a
database-backed store for cloud deployments.
Implementations§
Source§impl<S: SchemaStore> SchemaManager<S>
impl<S: SchemaStore> SchemaManager<S>
pub fn new(upstream_id: impl Into<String>, store: S) -> Self
pub fn upstream_id(&self) -> &str
Sourcepub async fn warm(&self, method: &str)
pub async fn warm(&self, method: &str)
Seed the in-memory state for method from the store.
Callers normally don’t need to invoke this directly — ingest
lazy-warms on the first call for a method. Exposed for explicit
startup warm-up when desired.
Sourcepub async fn ingest(
&self,
method: &str,
request_body: &Value,
response_body: &Value,
) -> Option<SchemaVersion>
pub async fn ingest( &self, method: &str, request_body: &Value, response_body: &Value, ) -> Option<SchemaVersion>
Feed a schema-method response through the manager.
Returns Some(version) when a new SchemaVersion was created
(pagination complete AND content differs from the current
version). Returns None when:
- The response is not a complete page (still buffering).
- The content hash matches the current version.
- The response has no
resultfield.
Sourcepub async fn latest(&self, method: &str) -> Option<SchemaVersion>
pub async fn latest(&self, method: &str) -> Option<SchemaVersion>
Latest stored version for method, or None if nothing has
been ingested yet.
pub async fn list_tools(&self) -> Vec<Value>
pub async fn list_resources(&self) -> Vec<Value>
pub async fn list_resource_templates(&self) -> Vec<Value>
pub async fn list_prompts(&self) -> Vec<Value>
pub async fn get_tool(&self, name: &str) -> Option<Value>
pub async fn get_resource(&self, uri: &str) -> Option<Value>
pub async fn get_prompt(&self, name: &str) -> Option<Value>
Sourcepub fn mark_stale(&self, method: &str)
pub fn mark_stale(&self, method: &str)
Mark the current version for method as stale. Idempotent.
Sync on purpose — the stale flag is used by the hot request
path (observing notifications/tools/list_changed) where a
round-trip to async code would be overkill.