1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
//! Macros for integrating elicitation with rmcp tool routers.
//!
//! This module provides two macros for different integration patterns:
//! - `elicit_router!` - Creates a standalone router struct
//! - `elicit_tools!` - Generates tool methods inside an existing impl block
/// Creates an aggregator struct that registers elicit_checked tools from multiple types.
///
/// # Example
///
/// ```ignore
/// elicit_router! {
/// pub ElicitRouter: Config, User, Settings
/// }
/// ```
///
/// This generates:
/// - A struct `ElicitRouter`
/// - An impl block with `#[tool_router]` attribute
/// - Proxy methods with `#[tool]` for each type's elicit_checked
///
/// The proxy methods forward calls to the original `Type::elicit_checked(peer)`.
};
}
/// Generates elicitation tool methods inside an existing `#[tool_router]` impl block.
///
/// Use this when you want to add elicitation tools to an existing server type
/// without creating a separate router. The generated methods will be part of
/// your server's `ToolRouter<YourServer>`.
///
/// # Example
///
/// ```ignore
/// use elicitation::elicit_tools;
///
/// #[rmcp::tool_router]
/// impl MyServer {
/// // Your existing tool methods...
///
/// #[tool]
/// async fn my_custom_tool(&self) -> Result<String, rmcp::ErrorData> {
/// Ok("hello".to_string())
/// }
///
/// // Add elicitation tools
/// elicit_tools! {
/// CacheKeyNewParams,
/// StorageNewParams,
/// MyOtherType,
/// }
/// }
/// ```
///
/// This generates tool methods like:
/// ```ignore
/// #[tool]
/// async fn elicit_cache_key_new_params(
/// &self,
/// peer: Peer<RoleServer>,
/// ) -> Result<CacheKeyNewParams, ElicitError> {
/// CacheKeyNewParams::elicit_checked(peer).await
/// }
/// ```
///
/// # Pattern Comparison
///
/// **Standalone router** (when you only want elicitation):
/// ```ignore
/// elicit_router! {
/// pub ElicitRouter: Type1, Type2, Type3
/// }
/// ```
///
/// **Embedded in existing router** (when you have other tools):
/// ```ignore
/// #[tool_router]
/// impl MyServer {
/// // Other tools...
///
/// elicit_tools! { Type1, Type2, Type3 }
/// }
/// ```