Files
crank/crates/crank-community-mcp/src/app/rmcp_dispatch.rs
T
bsodfather 3b30aad28e
CI / UI Checks (pull_request) Successful in 8s
CI / Rust Checks (pull_request) Successful in 35m42s
CI / Rust Feature Validation (pull_request) Skipped
CI / Frontend E2E (pull_request) Skipped
CI / Community Image Smoke (pull_request) Skipped
CI / Required Checks (pull_request) Successful in 1s
CI / Deploy (pull_request) Skipped
MCP: execute Tools through request-scoped SDK handlers
2026-11-13 16:57:28 +00:00

54 lines
1.7 KiB
Rust

//! Runtime SDK dispatch; admission, lifecycle and response projection stay with the caller.
use std::sync::Arc;
use serde_json::Value;
use super::{AppState, lifecycle::ToolCallLifecycle};
use crate::protocol::{ServiceContext, ToolsCommand};
pub(super) async fn handle_tools_command(
state: &Arc<AppState>,
context: ServiceContext<'_>,
command: ToolsCommand,
lifecycle: Option<ToolCallLifecycle>,
) -> super::rmcp_tools_runtime::Outcome {
super::rmcp_tools_runtime::handle(state, context, command, lifecycle).await
}
pub(super) async fn handle_prompts_command(
state: &Arc<AppState>,
context: ServiceContext<'_>,
revision: &str,
command: crate::protocol::PromptsCommand,
) -> crate::protocol::PromptsOutcome {
super::rmcp_prompts::handle(state, context, revision, command).await
}
pub(super) async fn handle_resources_command(
state: &Arc<AppState>,
context: ServiceContext<'_>,
revision: &str,
command: crate::protocol::ResourcesCommand,
) -> crate::protocol::ResourcesOutcome {
super::rmcp_resources::handle(state, context, revision, command).await
}
pub(super) async fn list_resource_templates(
state: &Arc<AppState>,
context: ServiceContext<'_>,
revision: &str,
command: crate::protocol::ResourcesListCommand,
) -> Result<(Vec<Value>, Option<String>), crate::protocol::ResourceTemplatesListError> {
super::rmcp_resources::templates(state, context, revision, command).await
}
pub(super) async fn handle_completion_command(
state: &Arc<AppState>,
context: ServiceContext<'_>,
revision: &str,
command: crate::protocol::CompletionCommand,
) -> crate::protocol::CompletionOutcome {
super::rmcp_completion::handle(state, context, revision, command).await
}