turbomcp_server/handlers/composite.rs
1//! Composite handler pattern for handling multiple types of requests
2
3use crate::handlers::traits::*;
4
5/// Composite handler that can handle multiple types of requests
6pub trait CompositeHandler: Send + Sync {
7 /// Get tool handler if this composite handles tools
8 fn as_tool_handler(&self) -> Option<&dyn ToolHandler> {
9 None
10 }
11
12 /// Get prompt handler if this composite handles prompts
13 fn as_prompt_handler(&self) -> Option<&dyn PromptHandler> {
14 None
15 }
16
17 /// Get resource handler if this composite handles resources
18 fn as_resource_handler(&self) -> Option<&dyn ResourceHandler> {
19 None
20 }
21
22 /// Get sampling handler if this composite handles sampling
23 fn as_sampling_handler(&self) -> Option<&dyn SamplingHandler> {
24 None
25 }
26
27 /// Get logging handler if this composite handles logging
28 fn as_logging_handler(&self) -> Option<&dyn LoggingHandler> {
29 None
30 }
31
32 /// Get elicitation handler if this composite handles elicitation
33 fn as_elicitation_handler(&self) -> Option<&dyn ElicitationHandler> {
34 None
35 }
36
37 /// Get completion handler if this composite handles completion
38 fn as_completion_handler(&self) -> Option<&dyn CompletionHandler> {
39 None
40 }
41
42 /// Get resource template handler if this composite handles resource templates
43 fn as_resource_template_handler(&self) -> Option<&dyn ResourceTemplateHandler> {
44 None
45 }
46
47 /// Get ping handler if this composite handles ping
48 fn as_ping_handler(&self) -> Option<&dyn PingHandler> {
49 None
50 }
51}