mcp_server_rs/router/
capabilities.rs1use mcp_core_rs::protocol::capabilities::{
2 PromptsCapability, ResourcesCapability, ServerCapabilities, ToolsCapability,
3};
4
5pub struct CapabilitiesBuilder {
7 tools: Option<ToolsCapability>,
8 prompts: Option<PromptsCapability>,
9 resources: Option<ResourcesCapability>,
10}
11
12impl Default for CapabilitiesBuilder {
13 fn default() -> Self {
14 Self::new()
15 }
16}
17
18impl CapabilitiesBuilder {
19 pub fn new() -> Self {
20 Self {
21 tools: None,
22 prompts: None,
23 resources: None,
24 }
25 }
26
27 pub fn with_tools(mut self, list_changed: bool) -> Self {
29 self.tools = Some(ToolsCapability {
30 list_changed: Some(list_changed),
31 });
32 self
33 }
34
35 pub fn with_prompts(mut self, list_changed: bool) -> Self {
37 self.prompts = Some(PromptsCapability {
38 list_changed: Some(list_changed),
39 });
40 self
41 }
42
43 pub fn with_resources(mut self, subscribe: bool, list_changed: bool) -> Self {
45 self.resources = Some(ResourcesCapability {
46 subscribe: Some(subscribe),
47 list_changed: Some(list_changed),
48 });
49 self
50 }
51
52 pub fn build(self) -> ServerCapabilities {
54 ServerCapabilities {
56 tools: self.tools,
57 prompts: self.prompts,
58 resources: self.resources,
59 }
60 }
61}